[pLog-svn] r2170 - plugins/trunk/mobile

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sun Jun 5 13:43:51 GMT 2005


Author: oscar
Date: 2005-06-05 13:43:50 +0000 (Sun, 05 Jun 2005)
New Revision: 2170

Modified:
   plugins/trunk/mobile/pluginmobile.class.php
Log:
added a few methods to the plugin class to automatically generate the mobile urls
for a blog and a post.


Modified: plugins/trunk/mobile/pluginmobile.class.php
===================================================================
--- plugins/trunk/mobile/pluginmobile.class.php	2005-06-05 13:19:08 UTC (rev 2169)
+++ plugins/trunk/mobile/pluginmobile.class.php	2005-06-05 13:43:50 UTC (rev 2170)
@@ -2,6 +2,10 @@
 
     include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
     
+    if( !defined( "MOBILE_PLOG_CLASS_PATH" )) {
+        define( "MOBILE_PLOG_CLASS_PATH", PLOG_CLASS_PATH."plugins/mobile/" );
+    }        
+    
     class PluginMobile extends PluginBase
     {
     
@@ -13,5 +17,31 @@
             $this->desc = "Allows pLog blogs to be accessed via mobile terminals";
             $this->author = "The pLog Project";
         }
+     
+        /** 
+         * Returns a link to the mobile view of a blog
+         *
+         * @param blog A valid BlogInfo object
+         * @return A valid URL
+         */   
+        function blogLink( $blog )
+        {
+            include_once( MOBILE_PLOG_CLASS_PATH."class/net/mobilerequestgenerator.class.php" );
+            $murl = new MobileRequestGenerator( $blog );
+            return( $murl->getMobileUrl()."?blogId=".$blog->getId()); 
+        }
+
+        /** 
+         * Returns a link to the mobile view of a post
+         *
+         * @param blog A valid BlogInfo object
+         * @return A valid URL
+         */           
+        function articleLink( $article )
+        {
+            include_once( MOBILE_PLOG_CLASS_PATH."class/net/mobilerequestgenerator.class.php" );
+            $murl = new MobileRequestGenerator( $blog );
+            return( $murl->getMobileUrl()."?op=ViewArticle&blogId=".$this->blogInfo->getId()."&articleId=".$article->getId());         
+        }
     }
 ?>
\ No newline at end of file




More information about the pLog-svn mailing list