46cl / wp-boilerplate

[unstable] A Wordpress boilerplate created by 46cl
MIT License
3 stars 1 forks source link

Create helpers for Ajax/JSON endpoints #4

Closed jvelo closed 9 years ago

jvelo commented 9 years ago

A first version could be :

Ajax::endpoint($action, $handler) // for back-office end-points
Ajax::publicEndpoint($action, $handler) // for publicly accessible end-points

WDYT ?

nesk commented 9 years ago

I agree with this feature, however the API should be based on class instantiation and we should provide 3 ways to create an endpoint. These classes should be stored in a namespace, as expected by #10:

new Ajax\Endpoint($action, $handler, $isPrivate = false);
new Ajax\PrivateEndpoint($action, $handler);
new Ajax\PublicEndpoint($action, $handler);