added 'object' key to the XML-RPCS config allowing the passing of a class object for method calls that aren't part of the CI super object
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index 1b2ffca..7a4bc82 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -41,7 +41,9 @@
var $system_methods = array(); // XML RPC Server methods
var $controller_obj;
-
+ var $object = FALSE;
+
+
//-------------------------------------
// Constructor, more or less
//-------------------------------------
@@ -74,6 +76,11 @@
{
$this->debug = $config['debug'];
}
+
+ if (isset($config['object']) && is_object($config['object']))
+ {
+ $this->object = $config['object'];
+ }
}
//-------------------------------------
@@ -320,11 +327,16 @@
}
else
{
- $CI =& get_instance();
- return $CI->$method_parts['1']($m);
- //$class = new $method_parts['0'];
- //return $class->$method_parts['1']($m);
- //return call_user_func(array(&$method_parts['0'],$method_parts['1']), $m);
+ if ($this->object === FALSE)
+ {
+ $CI =& get_instance();
+ return $CI->$method_parts['1']($m);
+ }
+ else
+ {
+ return $this->object->$method_parts['1']($m);
+ //return call_user_func(array(&$method_parts['0'],$method_parts['1']), $m);
+ }
}
}
else
diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html
index e77158c..b7e98f6 100644
--- a/user_guide/libraries/xmlrpc.html
+++ b/user_guide/libraries/xmlrpc.html
@@ -180,8 +180,9 @@
$this->load->library('xmlrpc');<br />
$this->load->library('xmlrpcs');<br />
<br />
-$config['functions']['<var>new_post</var>'] = array('function' => '<dfn>My_blog.new_entry</dfn>');<br />
-$config['functions']['<var>update_post</var>'] = array('function' => '<dfn>My_blog.update_entry</dfn>');<br />
+$config['functions]['<var>new_post</var>'] = array('function' => '<dfn>My_blog.new_entry</dfn>'),<br />
+$config['functions]['<var>update_post</var>'] = array('function' => '<dfn>My_blog.update_entry</dfn>');<br />
+$config['object'] = $this;<br />
<br />
$this->xmlrpcs->initialize($config);<br />
$this->xmlrpcs->serve();</code>
@@ -189,6 +190,9 @@
<p>The above example contains an array specifying two method requests that the Server allows.
The allowed methods are on the left side of the array. When either of those are received, they will be mapped to the class and method on the right.</p>
+<p>The '<var>object</var>' key is a special key that you pass an instantiated class object with, which is necessary when the method you are mapping to is not
+ part of the CodeIgniter super object.</p>
+
<p>In other words, if an XML-RPC Client sends a request for the <var>new_post</var> method, your
server will load the <dfn>My_blog</dfn> class and call the <dfn>new_entry</dfn> function.
If the request is for the <var>update_post</var> method, your
@@ -196,8 +200,7 @@
<p>The function names in the above example are arbitrary. You'll decide what they should be called on your server,
or if you are using standardized APIs, like the Blogger or MetaWeblog API, you'll use their function names.</p>
-
-
+
<h2>Processing Server Requests</h2>
<p>When the XML-RPC Server receives a request and loads the class/method for processing, it will pass