[pLog-svn] r4347 - in plugins/branches/lifetype-1.1: . linkcounter linkcounter/class linkcounter/class/action linkcounter/class/view linkcounter/locale linkcounter/templates

pwestbro at devel.lifetype.net pwestbro at devel.lifetype.net
Mon Nov 27 04:42:00 GMT 2006


Author: pwestbro
Date: 2006-11-27 04:41:57 +0000 (Mon, 27 Nov 2006)
New Revision: 4347

Added:
   plugins/branches/lifetype-1.1/linkcounter/
   plugins/branches/lifetype-1.1/linkcounter/class/
   plugins/branches/lifetype-1.1/linkcounter/class/action/
   plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterconfigaction.class.php
   plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterupdateconfigaction.class.php
   plugins/branches/lifetype-1.1/linkcounter/class/view/
   plugins/branches/lifetype-1.1/linkcounter/class/view/pluginlinkcounterconfigview.class.php
   plugins/branches/lifetype-1.1/linkcounter/locale/
   plugins/branches/lifetype-1.1/linkcounter/locale/locale_en_UK.php
   plugins/branches/lifetype-1.1/linkcounter/pluginlinkcounter.class.php
   plugins/branches/lifetype-1.1/linkcounter/readme.txt
   plugins/branches/lifetype-1.1/linkcounter/templates/
   plugins/branches/lifetype-1.1/linkcounter/templates/linkcounter.template
Log:
Added the Technorati Link Counter Widget
(http://www.technorati.com/tools/linkcount/) plugin



Added: plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterconfigaction.class.php	2006-11-26 22:14:35 UTC (rev 4346)
+++ plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterconfigaction.class.php	2006-11-27 04:41:57 UTC (rev 4347)
@@ -0,0 +1,45 @@
+<?php
+
+    /*
+    Copyright 2006 Paul Westbrook (paul at westbrooks.org)
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+    
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    */
+    
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/linkcounter/class/view/pluginlinkcounterconfigview.class.php" );
+
+	/**
+	 * shows a form with the current configuration
+	 */
+	class PluginLinkcounterConfigAction extends AdminAction
+	{
+		
+		function PluginLinkcounterConfigAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function perform()
+		{
+            $this->_view = new PluginLinkcounterConfigView( $this->_blogInfo );
+			
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterupdateconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterupdateconfigaction.class.php	2006-11-26 22:14:35 UTC (rev 4346)
+++ plugins/branches/lifetype-1.1/linkcounter/class/action/pluginlinkcounterupdateconfigaction.class.php	2006-11-27 04:41:57 UTC (rev 4347)
@@ -0,0 +1,78 @@
+<?php
+
+    /*
+    Copyright 2006 Paul Westbrook (paul at westbrooks.org)
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+    
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    */
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/linkcounter/class/view/pluginlinkcounterconfigview.class.php" );
+		
+	/**
+	 * updates the plugin configuration
+	 */
+	class PluginLinkcounterUpdateConfigAction extends AdminAction
+	{
+		var $pluginEnabled;
+		
+		function PluginLinkcounterUpdateConfigAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function validate()
+		{
+
+            $this->pluginEnabled = $this->_request->getValue( "pluginEnabled" );
+            $this->pluginEnabled = ($this->pluginEnabled != "" );			
+			
+			return true;
+		}
+		        
+		function perform()
+		{
+
+            // update the plugin configurations to blog setting
+			$blogSettings = $this->_blogInfo->getSettings();
+            $blogSettings->setValue( "plugin_linkcounter_enabled", $this->pluginEnabled );
+            $this->_blogInfo->setSettings( $blogSettings ); 
+		
+			// save the blogs settings
+			$blogs = new Blogs();
+            if( !$blogs->updateBlog( $this->_blogInfo )) {
+                $this->_view = new PluginLinkcounterConfigView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
+                $this->setCommonData();
+
+                return false;                       
+            }
+			
+			// if everything went ok...
+            $this->_blogInfo->setSettings( $blogSettings );
+            $this->_session->setValue( "blogInfo", $this->_blogInfo );
+            $this->saveSession();
+			
+			$this->_view = new PluginLinkcounterConfigView( $this->_blogInfo );
+			$this->_view->setSuccessMessage( $this->_locale->tr("linkcounter_settings_saved_ok"));			
+			$this->setCommonData();
+			
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());					
+            
+            return true;		
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/branches/lifetype-1.1/linkcounter/class/view/pluginlinkcounterconfigview.class.php
===================================================================
--- plugins/branches/lifetype-1.1/linkcounter/class/view/pluginlinkcounterconfigview.class.php	2006-11-26 22:14:35 UTC (rev 4346)
+++ plugins/branches/lifetype-1.1/linkcounter/class/view/pluginlinkcounterconfigview.class.php	2006-11-27 04:41:57 UTC (rev 4347)
@@ -0,0 +1,46 @@
+<?php
+    /*
+    Copyright 2006 Paul Westbrook (paul at westbrooks.org)
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+    
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    */
+
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginLinkcounterConfigView extends AdminPluginTemplatedView
+	{
+		function PluginLinkcounterConfigView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "linkcounter", "linkcounter" );
+			
+		}
+		
+		function render()
+		{
+			// load some configuration settings
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_linkcounter_enabled" );
+			
+			// create a view and export the settings to the template
+			$this->setValue( "pluginEnabled", $pluginEnabled );		
+			
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/branches/lifetype-1.1/linkcounter/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.1/linkcounter/locale/locale_en_UK.php	2006-11-26 22:14:35 UTC (rev 4346)
+++ plugins/branches/lifetype-1.1/linkcounter/locale/locale_en_UK.php	2006-11-27 04:41:57 UTC (rev 4347)
@@ -0,0 +1,14 @@
+<?php
+$messages["manageAppearancePlugins"] = "Appearance Management";
+$messages["linkcounter"] = "Link Counter";
+
+$messages["linkcounter_plugin_enabled"] = "Enable Link Conter";
+$messages["linkcounter_plugin"] = "Link Counter";
+$messages["detail"] = "Detail";
+
+$messages["linkcounter_settings_saved_ok"] = "Link Counter settings saved successfully!";
+
+$messages["label_configuration"] = "Configuration";
+$messages["label_enable"] = "Enable";
+$messages["linkcounter_enable_description"] = "This option changes enables the Technorati Link Counter Widget";
+?>
\ No newline at end of file

Added: plugins/branches/lifetype-1.1/linkcounter/pluginlinkcounter.class.php
===================================================================
--- plugins/branches/lifetype-1.1/linkcounter/pluginlinkcounter.class.php	2006-11-26 22:14:35 UTC (rev 4346)
+++ plugins/branches/lifetype-1.1/linkcounter/pluginlinkcounter.class.php	2006-11-27 04:41:57 UTC (rev 4347)
@@ -0,0 +1,91 @@
+<?php
+    /*
+    Copyright 2006 Paul Westbrook (paul at westbrooks.org)
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+    
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    */
+
+
+
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+	include_once( PLOG_CLASS_PATH."class/template/menu/menu.class.php" );
+
+
+	class PluginLinkcounter extends PluginBase
+	{
+
+		var $pluginEnabled;
+		
+		function PluginLinkcounter()
+		{
+			$this->PluginBase();
+
+			$this->id      = "linkcounter";
+			$this->author  = "Paul Westbrook";
+			$this->desc    = "This plugin enables extended Technorati Link Counter Widget.";
+
+			$this->locales = Array( "en_UK");
+
+			$this->init();
+		}
+
+		function init()
+		{
+            $this->registerAdminAction( "linkcounterConfig", "PluginLinkcounterConfigAction" );
+			$this->registerAdminAction( "updateLinkcounterConfig", "PluginLinkcounterUpdateConfigAction" );
+			
+			$menu =& Menu::getMenu();
+            if( !$menu->entryExists( "/menu/controlCenter/manageAppearancePlugins" ))                     
+                $this->addMenuEntry( "/menu/controlCenter", "manageAppearancePlugins", "", "", true, false );
+            $this->addMenuEntry( "/menu/controlCenter/manageAppearancePlugins", "linkcounter", "?op=linkcounterConfig", "" );
+		}
+
+		function register()
+		{
+		    $blogSettings = $this->blogInfo->getSettings();
+			$this->pluginEnabled = $blogSettings->getValue( "plugin_linkcounter_enabled" );
+		}
+		
+		
+	    function isEnabled()
+	    {
+	        return $this->pluginEnabled;
+	    }
+	    
+
+	    function show($postId)
+	    {
+			$str = '';
+	    
+            if ($this->isEnabled())
+            {
+            
+                // articles object
+                $articles = new Articles;
+    
+    
+                $rg = $this->blogInfo->getBlogRequestGenerator();
+				$rg->setXHTML( false );
+                $post = $articles->getBlogArticle($postId);
+                $str .= '<script src="http://embed.technorati.com/linkcount" type="text/javascript"></script>';
+                $str .= '<a href="http://technorati.com/search/' . urlencode($rg->postPermalink($post)) . '" rel="linkcount">View blog reactions</a>';
+             }
+	    	return $str;
+		}
+		
+
+	}
+?>
\ No newline at end of file

Added: plugins/branches/lifetype-1.1/linkcounter/readme.txt
===================================================================
--- plugins/branches/lifetype-1.1/linkcounter/readme.txt	2006-11-26 22:14:35 UTC (rev 4346)
+++ plugins/branches/lifetype-1.1/linkcounter/readme.txt	2006-11-27 04:41:57 UTC (rev 4347)
@@ -0,0 +1,19 @@
+Plugin: MovableType
+Author: paul at westbrooks.org
+Release Date: 2006/11/26
+Version: 1.0
+
+Implements the Technorati Link Counter Widget (http://www.technorati.com/tools/linkcount/) for LifeType.
+
+[USAGES]: 
+1. Upload: Upload all the extract files and directories to $LifeType_Install_Dir/plugin/linkcounter 
+2. Add the following to post.template:
+    $linkcounter->show($postId) 
+
+
+[EXAMPLE]: 
+Add the following code in post.template : 
+
+Code: 
+{assign var="postId" value=$post->getId()} 
+{$linkcounter->show($)} 

Added: plugins/branches/lifetype-1.1/linkcounter/templates/linkcounter.template
===================================================================
--- plugins/branches/lifetype-1.1/linkcounter/templates/linkcounter.template	2006-11-26 22:14:35 UTC (rev 4346)
+++ plugins/branches/lifetype-1.1/linkcounter/templates/linkcounter.template	2006-11-27 04:41:57 UTC (rev 4347)
@@ -0,0 +1,23 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=linkcounter title=$locale->tr("linkcounter_plugin")}
+<form name="linkcounterPluginConfig" method="post">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("label_configuration")}</legend>  
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}   
+  <div class="field">
+   <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
+   <div class="formHelp"> {$locale->tr("linkcounter_enable_description")}</div>  
+    <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("linkcounter_plugin_enabled")}
+ 
+  </div>
+ </fieldset>  
+
+ <div class="buttons">
+  <input type="hidden" name="op" value="updateLinkcounterConfig" />
+  <input type="reset" name="{$locale->tr("reset")}" />    
+  <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
+ </div>
+</form>
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}



More information about the pLog-svn mailing list