Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * A simple example of the XML-RPC module that shows you how easy it is to expose
- * complex data types
- *
- * @package xmlrpc
- * @subpackage controllers
- */
- class XMLRPCExample extends XMLRPCServer {
- /**
- * Returns a list of time zones
- *
- * @return array
- */
- public function timeZones() {
- return array (
- 'Server Time' => new DateTime('now'),
- 'Sydney Time' => new DateTime('now', new DateTimeZone('Australia/Sydney')),
- );
- }
- /**
- * Returns all the methods passed to it
- *
- * @return arrau
- */
- public function methodArguments() {
- return func_get_args();
- }
- /**
- * Throw an authentication error
- */
- public function authenticationError() {
- throw new XMLRPCException(-31000);
- }
- // ---------------------------------------------------------------------------
- /**
- * Exposes all the example methods to the XML-RPC interface
- */
- public function setMethods() {
- parent::setMethods();
- $this->addMethod('example.timeZones', array($this, 'timeZones'));
- $this->addMethod('example.methodArguments', array($this, 'methodArguments'));
- $this->addMethod('example.authenticationError', array($this, 'authenticationError'));
- }
- }
Add Comment
Please, Sign In to add comment