[wp-hackers] How to exntend wp_xmlrpc_server in plugin

Edward de Leau e at leau.net
Fri Aug 3 17:31:41 UTC 2012


Check also the example here:
http://wordpress.stackexchange.com/questions/39473/custom-xmlrpc-method-plus-authentication-of-user-woocommerce-order

I used this example in my plugin.

Server part (uses transients to cache server calls)

1.
http://plugins.svn.wordpress.org/wp-favicons/trunk/includes/server/class-xmlrpc.php(main)
2.
http://plugins.svn.wordpress.org/wp-favicons/trunk/includes/server/class-uri-xmlrpc.php(first
extension)

Client part (uses transients to cache client calls)

http://plugins.svn.wordpress.org/wp-favicons/trunk/includes/client/class-xmlrpc.php





On Fri, Aug 3, 2012 at 6:01 PM, peter baylies <
pbaylies at semperfiwebdesign.com> wrote:

> Ryan,
>
> I don't know the real nitty gritty details here re: opcode caching, but
> I'll ask, how is this manifestly different from what WordPress plugins
> already do? Classes get conditionally included from functions all the time,
> and PHP opcode caches appear to deal with that just fine. See, for example,
> the code for activate_plugin() in wp-admin/includes/plugin.php.
>
> Cheers,
>
>  -- Peter
>
>
> On Fri, Aug 3, 2012 at 8:32 AM, Ryan McCue <lists at rotorised.com> wrote:
>
> > Otto wrote:
> > > function my_class($name) {
> > >
> > > class my_xmlrpc_class extends wp_xmlrpc_server {
> > > ... class stuff here ...
> > > }
> > >
> > > return 'my_xmlrpc_class';
> > > }
> >
> > Correct me if I'm wrong, but wouldn't this have a huge performance
> > penalty, since you're declaring a class inside a function? (Which IIRC
> > can't be cached properly by an opcode cache)
> >
> > (In this case, I'm assuming it's necessary since wp_xmlrpc_server won't
> > be declared when the plugin is loaded, but I'd like to make sure.)
> > --
> > Ryan McCue
> > <http://ryanmccue.info/>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list