summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Xmlrpcs.php24
-rw-r--r--user_guide/libraries/xmlrpc.html11
2 files changed, 25 insertions, 10 deletions
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index 1b2ffca05..7a4bc825e 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -41,7 +41,9 @@ class CI_Xmlrpcs extends CI_Xmlrpc
var $system_methods = array(); // XML RPC Server methods
var $controller_obj;
-
+ var $object = FALSE;
+
+
//-------------------------------------
// Constructor, more or less
//-------------------------------------
@@ -74,6 +76,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc
{
$this->debug = $config['debug'];
}
+
+ if (isset($config['object']) && is_object($config['object']))
+ {
+ $this->object = $config['object'];
+ }
}
//-------------------------------------
@@ -320,11 +327,16 @@ class CI_Xmlrpcs extends CI_Xmlrpc
}
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 e77158c47..b7e98f653 100644
--- a/user_guide/libraries/xmlrpc.html
+++ b/user_guide/libraries/xmlrpc.html
@@ -180,8 +180,9 @@ class and method for processing.</p>
$this->load->library('xmlrpc');<br />
$this->load->library('xmlrpcs');<br />
<br />
-$config['functions']['<var>new_post</var>']&nbsp;&nbsp;= 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 @@ $this->xmlrpcs->serve();</code>
<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 @@ server will load the <dfn>My_blog</dfn> class and call the <dfn>update_entry</df
<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