[pLog-svn] r800 - in plugins/trunk/articlereferers: . class/action locale

mark at devel.plogworld.net mark at devel.plogworld.net
Sun Jan 23 16:43:53 GMT 2005


Author: mark
Date: 2005-01-23 16:43:52 +0000 (Sun, 23 Jan 2005)
New Revision: 800

Added:
   plugins/trunk/articlereferers/readme.txt
Modified:
   plugins/trunk/articlereferers/class/action/pluginarticlereferersconfigaction.class.php
   plugins/trunk/articlereferers/class/action/pluginarticlereferersupdateconfigaction.class.php
   plugins/trunk/articlereferers/locale/locale_en_UK.php
   plugins/trunk/articlereferers/pluginarticlereferers.class.php
Log:
Move the description to readme.txt to reduce the pluign loading time.

Modified: plugins/trunk/articlereferers/class/action/pluginarticlereferersconfigaction.class.php
===================================================================
--- plugins/trunk/articlereferers/class/action/pluginarticlereferersconfigaction.class.php	2005-01-23 15:52:43 UTC (rev 799)
+++ plugins/trunk/articlereferers/class/action/pluginarticlereferersconfigaction.class.php	2005-01-23 16:43:52 UTC (rev 800)
@@ -1,38 +1,38 @@
-<?php
-
-	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );	
-
-	/**
-	 * shows a form with the current configuration
-	 */
-	class PluginArticleReferersConfigAction extends AdminAction
-	{
-		
-		function PluginArticleReferersConfigAction( $actionInfo, $request )
-		{
-			$this->AdminAction( $actionInfo, $request );
-		}
-		
-		function perform()
-		{
-			// load some configuration settings
-			$blogSettings = $this->_blogInfo->getSettings();
-			$pluginEnabled = $blogSettings->getValue( "plugin_articlereferers_enabled" );
-			$sortByField = $blogSettings->getValue( "plugin_articlereferers_sortbyfield" );
-			if ($sortByField == "") $sortByField = 1;
-			$maxReferers = $blogSettings->getValue( "plugin_articlereferers_maxreferers" );
-			if ($maxReferers == "") $maxReferers = 10;
-			
-			// create a view and export the settings to the template
-			$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "articlereferers", "articlereferers", true );
-			$this->_view->setValue( "pluginEnabled", $pluginEnabled );
-			$this->_view->setValue( "sortByField", $sortByField );
-			$this->_view->setValue( "maxReferers", $maxReferers );
-			
-			$this->setCommonData();
-			
-			return true;
-		}
-	}
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );	
+
+	/**
+	 * shows a form with the current configuration
+	 */
+	class PluginArticleReferersConfigAction extends AdminAction
+	{
+		
+		function PluginArticleReferersConfigAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function perform()
+		{
+			// load some configuration settings
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_articlereferers_enabled" );
+			$sortByField = $blogSettings->getValue( "plugin_articlereferers_sortbyfield" );
+			if ($sortByField == "") $sortByField = 1;
+			$maxReferers = $blogSettings->getValue( "plugin_articlereferers_maxreferers" );
+			if ($maxReferers == "") $maxReferers = 10;
+			
+			// create a view and export the settings to the template
+			$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "articlereferers", "articlereferers", true );
+			$this->_view->setValue( "pluginEnabled", $pluginEnabled );
+			$this->_view->setValue( "sortByField", $sortByField );
+			$this->_view->setValue( "maxReferers", $maxReferers );
+			
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
 ?>
\ No newline at end of file

Modified: plugins/trunk/articlereferers/class/action/pluginarticlereferersupdateconfigaction.class.php
===================================================================
--- plugins/trunk/articlereferers/class/action/pluginarticlereferersupdateconfigaction.class.php	2005-01-23 15:52:43 UTC (rev 799)
+++ plugins/trunk/articlereferers/class/action/pluginarticlereferersupdateconfigaction.class.php	2005-01-23 16:43:52 UTC (rev 800)
@@ -22,6 +22,7 @@
 		{
             $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
             $this->_pluginEnabled = ($this->_pluginEnabled != "" );	
+            $this->_sortByField = $this->_request->getValue( "sortByField" );
             $this->_maxReferers = $this->_request->getValue( "maxReferers" );
             if( $this->_maxReferers < 0 ) {
                 $this->_view = new AdminErrorView( $this->_blogInfo );
@@ -34,7 +35,7 @@
 		        
 		function perform()
 		{
-            // and check which smiley set we should be using, or if none, then the default one
+            // update the plugin configurations to blog setting
 			$blogSettings = $this->_blogInfo->getSettings();
             $blogSettings->setValue( "plugin_articlereferers_enabled", $this->_pluginEnabled );
             $blogSettings->setValue( "plugin_articlereferers_sortbyfield", $this->_sortByField );

Modified: plugins/trunk/articlereferers/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/articlereferers/locale/locale_en_UK.php	2005-01-23 15:52:43 UTC (rev 799)
+++ plugins/trunk/articlereferers/locale/locale_en_UK.php	2005-01-23 16:43:52 UTC (rev 800)
@@ -1,11 +1,11 @@
-<?php
-$messages["articlereferers_maxreferers"] = "Maximum Showed Referers (0 Means Show All)";
-$messages["articlereferers_sortbyfield"] = "Show Referers Order By";
-$messages["articlereferers_sortby_hits"] = "Hits";
-$messages["articlereferers_sortby_lastdate"] = "Last Date";
-$messages["articlereferers_plugin_configuration"] = "Configuration this plugin";
-$messages["articlereferers_plugin_enabled"] = "Enable this plugin";
-$messages["articlereferers_plugin"] = "Recent Comments Plugin";
-$messages["articlereferers_settings_saved_ok"] = "Recent Comments settings saved successfully!";
-$messages["articlereferers_error_maxreferers"] = "Maximum Showed Comments Should >= 0!";
+<?php
+$messages["articlereferers_maxreferers"] = "Maximum Showed Referers (0 Means Show All)";
+$messages["articlereferers_sortbyfield"] = "Show Referers Order By";
+$messages["articlereferers_sortby_hits"] = "Hits";
+$messages["articlereferers_sortby_lastdate"] = "Last Date";
+$messages["articlereferers_plugin_configuration"] = "Configuration this plugin";
+$messages["articlereferers_plugin_enabled"] = "Enable this plugin";
+$messages["articlereferers_plugin"] = "Recent Comments Plugin";
+$messages["articlereferers_settings_saved_ok"] = "Recent Comments settings saved successfully!";
+$messages["articlereferers_error_maxreferers"] = "Maximum Showed Comments Should >= 0!";
 ?>
\ No newline at end of file

Modified: plugins/trunk/articlereferers/pluginarticlereferers.class.php
===================================================================
--- plugins/trunk/articlereferers/pluginarticlereferers.class.php	2005-01-23 15:52:43 UTC (rev 799)
+++ plugins/trunk/articlereferers/pluginarticlereferers.class.php	2005-01-23 16:43:52 UTC (rev 800)
@@ -20,7 +20,7 @@
   
             $this->id = "articlereferers";
             $this->author = "Mark Wu";
-            $this->desc = "This plugin offers you to get the referers of the specific article. Usage as follow:<br /><br />Add the following code to postandcomments.template<br /><br /><strong>&lt;p&gt;<br />&lt;h3&gt;{\$locale-&gt;tr(&quot;referers&quot;)}&lt;/h3&gt;<br />{assign var=postid value=\$post-&gt;getId()}<br />{assign var=referers value=\$articlereferers-&gt;getArticleReferers(\$postid)}<br />{foreach from=\$referers item=referer}<br />&lt;li&gt;&lt;a href=&quot;{\$referer-&gt;getUrl()}&quot;&gt;{\$referer-&gt;getUrl()}&lt;/a&gt; ({\$referer-&gt;getCount()})&lt;/li&gt;<br />{/foreach}<br />&lt;/p&gt;</strong><br /><br />";
+            $this->desc = "This plugin offers you to get the referers of the specific article.";
   
             $config =& Config::getConfig();
             $this->prefix = $config->getValue('db_prefix');
@@ -36,9 +36,9 @@
 			$this->registerAdminAction( "updateArticleReferersConfig", "PluginArticleReferersUpdateConfigAction" );
 			
 			$menu =& Menu::getMenu();
-			if( !$menu->entryExists( "/menu/controlCenter/manageRecentActivities" ))						
-				$this->addMenuEntry( "/menu/controlCenter", "manageRecentActivities", "", "", true, false );			
-            $this->addMenuEntry( "/menu/controlCenter/manageRecentActivities", "ArticleReferers", "?op=articlereferers", "" );            
+			if( !$menu->entryExists( "/menu/controlCenter/manageRecentPlugins" ))						
+				$this->addMenuEntry( "/menu/controlCenter", "manageRecentPlugins", "", "", true, false );			
+            $this->addMenuEntry( "/menu/controlCenter/manageRecentPlugins", "ArticleReferers", "?op=articlereferers", "" );            
 		}
 
 		function register()

Added: plugins/trunk/articlereferers/readme.txt
===================================================================
--- plugins/trunk/articlereferers/readme.txt	2005-01-23 15:52:43 UTC (rev 799)
+++ plugins/trunk/articlereferers/readme.txt	2005-01-23 16:43:52 UTC (rev 800)
@@ -0,0 +1,28 @@
+Plugin: Article Referers
+Author: Mark Wu
+Release Date: 2005/01/23
+Version: 1.0
+
+This plugin offers you to get the referers of the specific article. Usage as followed:
+
+You can use:
+1. $articlereferers->isEnabled() to check the plugin is enabled or not. 
+2. $articlereferers->getArticleReferers( $articleId, $maxReferers , $sortByField ) to get the article referers. 
+
+Where:
+1. $articleId is the specific ariticle id
+2. $maxReferers is the the max referers you want to show. 0 means show all referers. Default is 10.
+3. $sortByField is the order of referers. 1 means sort by hits, and 2 means order by last visit date. Default is 1 
+
+Example:
+Add the following code to postandcomments.template:
+{if $articlereferers->isEnabled()}
+<p>
+<h3>{$locale->tr("referers")}</h3>
+{assign var=postid value=$post->getId()}
+{assign var=referers value=$articlereferers->getArticleReferers($postid)}
+{foreach from=$referers item=referer}
+<li><a href="{$referer->getUrl()}">{$referer->getUrl()|truncate:60:"..."|escape}</a> ({$referer->getCount()})</li>
+{/foreach}
+</p>
+{/if}
\ No newline at end of file




More information about the pLog-svn mailing list