[geeklog-cvs] Geeklog-1.x/system lib-plugins.php,1.131,1.132

Dirk Haun dhaun at qs1489.pair.com
Thu Aug 9 09:39:14 EDT 2007


Update of /cvsroot/geeklog/Geeklog-1.x/system
In directory qs1489.pair.com:/tmp/cvs-serv47996/system

Modified Files:
	lib-plugins.php 
Log Message:
More preparations for the internal and webservices APIs: PLG_invokeService


Index: lib-plugins.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/lib-plugins.php,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -d -r1.131 -r1.132
*** lib-plugins.php	9 Aug 2007 07:41:28 -0000	1.131
--- lib-plugins.php	9 Aug 2007 13:39:12 -0000	1.132
***************
*** 45,49 ****
  }
  
! require_once($_CONF['path_system'] . 'classes/plugin.class.php');
  
  // buffer for function names for the center block API
--- 45,55 ----
  }
  
! require_once $_CONF['path_system'] . 'classes/plugin.class.php';
! 
! // Response codes for the service invocation PLG_invokeService()
! define('PLG_RET_OK',                 0); 
! define('PLG_RET_ERROR',             -1);
! define('PLG_RET_PERMISSION_DENIED', -2);
! define('PLG_RET_AUTH_FAILED',       -3);
  
  // buffer for function names for the center block API
***************
*** 2263,2266 ****
--- 2269,2299 ----
              fclose ($fh);
          }
+     }
+ 
+     return $retval;
+ }
+ 
+ /**
+  * Invoke a service
+  *
+  * @param   string  type    The plugin type whose service is to be called
+  * @param   string  action  The service action to be performed
+  * @param   array   args    The arguments to be passed to the service invoked
+  * @param   array   output  The output variable that will contain the output after invocation
+  * @param   array   svc_msg The output variable that will contain the service messages
+  * @return  int             The result of the invocation
+  *
+  */
+ function PLG_invokeService($type, $action, $args, &$output, &$svc_msg)
+ {
+     $retval = PLG_RET_ERROR;
+ 
+     $output = '';
+     $svc_msg = '';
+ 
+     // Check if the plugin type and action are valid
+     $function = 'service_' . $action . '_' . $type;
+     if (function_exists($function)) {
+         $retval = $function($args, $output, $svc_msg);
      }
  




More information about the geeklog-cvs mailing list