public function initApi() { register_rest_route('app/v1', '/coupons', array('methods' => 'GET', 'callback' => array($this, 'getItems'), 'permission_callback' => function () { return current_user_can('level_0'); })); register_api_field('user', 'coupons', array('get_callback' => array($this, 'getCouponCount'), 'update_callback' => null, 'schema' => null)); }
public function __construct() { register_rest_route('e_ct/v1', '/categories/', array('methods' => 'GET', 'callback' => array($this, 'e_categories'))); register_rest_route('e_ct/v1', '/categories/(?P<id>\\d+)', array('methods' => 'GET', 'callback' => array($this, 'e_categories'))); register_rest_route('e_ct/v1', '/tags/', array('methods' => 'GET', 'callback' => array($this, 'e_tags'))); register_rest_route('e_ct/v1', '/tags/(?P<id>\\d+)', array('methods' => 'GET', 'callback' => array($this, 'e_tags'))); }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $base = $this->get_taxonomy_base($this->taxonomy); $query_params = $this->get_collection_params(); register_rest_route('wp/v2', '/terms/' . $base, array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => $query_params), array('methods' => WP_REST_Server::CREATABLE, 'callback' => array($this, 'create_item'), 'permission_callback' => array($this, 'create_item_permissions_check'), 'args' => $this->get_endpoint_args_for_item_schema(WP_REST_Server::CREATABLE)), 'schema' => array($this, 'get_public_item_schema'))); register_rest_route('wp/v2', '/terms/' . $base . '/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_item_permissions_check')), array('methods' => WP_REST_Server::EDITABLE, 'callback' => array($this, 'update_item'), 'permission_callback' => array($this, 'update_item_permissions_check'), 'args' => $this->get_endpoint_args_for_item_schema(WP_REST_Server::EDITABLE)), array('methods' => WP_REST_Server::DELETABLE, 'callback' => array($this, 'delete_item'), 'permission_callback' => array($this, 'delete_item_permissions_check')), 'schema' => array($this, 'get_public_item_schema'))); }
public function register_rest_routes() { register_rest_route(WP_REST_API_Log_Common::PLUGIN_NAME, '/entries', array('methods' => array(WP_REST_Server::READABLE), 'callback' => array($this, 'get_items'), 'permission_callback' => array($this, 'get_permissions_check'), 'args' => array('from' => array('default' => ''), 'to' => array('default' => current_time('mysql')), 'route' => array('default' => ''), 'route-match-type' => array('sanitize_callback' => 'sanitize_key', 'default' => 'exact'), 'after-id' => array('sanitize_callback' => 'absint', 'default' => 0), 'before-id' => array('sanitize_callback' => 'absint', 'default' => 0), 'page' => array('sanitize_callback' => 'absint', 'default' => 1), 'records-per-page' => array('sanitize_callback' => 'absint', 'default' => 20)))); register_rest_route(WP_REST_API_Log_Common::PLUGIN_NAME, '/entry/(?P<id>[\\d]+)', array('methods' => array(WP_REST_Server::READABLE), 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_permissions_check'), 'args' => array('id' => array('sanitize_callback' => 'absint', 'validate_callback' => array($this, 'validate_entry_id'), 'default' => 0)))); register_rest_route(WP_REST_API_Log_Common::PLUGIN_NAME, '/entry', array('methods' => array(WP_REST_Server::DELETABLE), 'callback' => array($this, 'delete_items'), 'permission_callback' => array($this, 'delete_items_permissions_check'), 'args' => array('older-than-seconds' => array('sanitize_callback' => 'absint', 'default' => DAY_IN_SECONDS * 30)))); register_rest_route(WP_REST_API_Log_Common::PLUGIN_NAME, '/routes', array('methods' => array(WP_REST_Server::READABLE), 'callback' => array($this, 'get_routes'), 'permission_callback' => array($this, 'get_permissions_check'))); }
/** * Register the routes for the objects of the controller. */ public function register_routes() { register_rest_route($this->namespace, '/' . $this->base, array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'), 'permission_callback' => array($this, 'get_items_permissions_check')))); register_rest_route($this->namespace, '/' . $this->base . '/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('context' => $this->get_context_param(array('default' => 'view')))))); register_rest_route($this->namespace, '/' . $this->base_type, array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item_types'), 'permission_callback' => array($this, 'get_items_permissions_check')))); register_rest_route($this->namespace, '/' . $this->base_type . '/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item_type'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('context' => $this->get_context_param(array('default' => 'view')))))); }
function register_routes() { /* * Setup Classes */ $settings_api = new wp_stripe_settings(); $customers_api = new wp_stripe_customers(); $plans_api = new wp_stripe_plans(); $coupons_api = new wp_stripe_coupons(); /** * Settings API */ register_rest_route('stripe-wp', '/settings', array('methods' => 'GET', 'callback' => array($settings_api, 'get_settings'), 'permission_callback' => array($this, 'verify_admin'))); register_rest_route('stripe-wp', '/settings', array('methods' => 'POST', 'callback' => array($settings_api, 'save_settings'), 'permission_callback' => array($this, 'verify_nonce'))); /** * Customers API */ register_rest_route('stripe-wp', '/customers', array(array('methods' => 'GET', 'callback' => array($customers_api, 'get_customers'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'POST', 'callback' => array($customers_api, 'new_customer'), 'permission_callback' => array($this, 'verify_admin')))); register_rest_route('stripe-wp', '/customers/(?P<id>.+)', array(array('methods' => 'POST', 'callback' => array($customers_api, 'save_customer'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'GET', 'callback' => array($customers_api, 'get_customers'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'DELETE', 'callback' => array($customers_api, 'delete_customer'), 'permission_callback' => array($this, 'verify_admin')))); /** * Plans */ register_rest_route('stripe-wp', '/plans', array(array('methods' => 'GET', 'callback' => array($plans_api, 'get_plans'), 'permission_callback' => array($this, 'verify_admin')))); register_rest_route('stripe-wp', '/plans/(?P<id>.+)', array(array('methods' => 'POST', 'callback' => array($plans_api, 'save_plan'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'GET', 'callback' => array($plans_api, 'get_plans'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'DELETE', 'callback' => array($plans_api, 'delete_plan'), 'permission_callback' => array($this, 'verify_admin')))); /** * Coupons */ register_rest_route('stripe-wp', '/coupons', array(array('methods' => 'GET', 'callback' => array($coupons_api, 'get_coupons'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'POST', 'callback' => array($coupons_api, 'new_coupon'), 'permission_callback' => array($this, 'verify_admin')))); register_rest_route('stripe-wp', '/coupons/(?P<id>.+)', array(array('methods' => 'POST', 'callback' => array($coupons_api, 'save_coupon'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'GET', 'callback' => array($coupons_api, 'get_coupons'), 'permission_callback' => array($this, 'verify_admin')), array('methods' => 'DELETE', 'callback' => array($coupons_api, 'delete_coupon'), 'permission_callback' => array($this, 'verify_admin')))); }
public function initApi() { register_rest_route('app/v1', '/phone/verify', array('methods' => 'POST', 'callback' => array($this, 'sendVerifyCode'), 'args' => array('phone' => array('validate_callback' => array($this, 'validatePhone'))))); register_rest_route('app/v1', '/login/phone', array('methods' => 'POST', 'callback' => array($this, 'processLogin'), 'args' => array('phone' => array('validate_callback' => array($this, 'validatePhone'))))); register_rest_route('app/v1', '/resetpass/phone', array('methods' => 'POST', 'callback' => array($this, 'processResetPassword'), 'args' => array('phone' => array('validate_callback' => array($this, 'validatePhone'))))); register_rest_route('app/v1', '/register/phone', array('methods' => 'POST', 'callback' => array($this, 'processRegister'), 'args' => array('phone' => array('validate_callback' => array($this, 'validatePhone'))))); }
public function register_endpoints() { $namespace = $this->container->getVar('endpoints-namespace'); register_rest_route($namespace, '/button-click', array('methods' => 'POST', 'callback' => array($this->container->make('idlikethis_Endpoints_ButtonClickHandlerInterface'), 'handle'))); register_rest_route($namespace, '/admin/reset-all', array('methods' => 'POST', 'callback' => array($this->container->make('idlikethis_Endpoints_ResetAllHandlerInterface'), 'handle'))); register_rest_route($namespace, '/admin/consolidate-all', array('methods' => 'POST', 'callback' => array($this->container->make('idlikethis_Endpoints_ConsolidateAllHandlerInterface'), 'handle'))); }
/** * Register the routes for the objects of the controller. * * @since 0.2.0 */ public function register_routes() { $namespace = util::get_namespace(); register_rest_route($namespace, '/products', array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('plugin' => array('default' => 'edd', 'sanitize_callback' => array($this, 'strip_tags'))))); register_rest_route($namespace, '/products/price/(?P<id>[\\d]+)', array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_price'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('plugin' => array('default' => 'edd', 'sanitize_callback' => array($this, 'strip_tags'))))); register_rest_route($namespace, '/products/plugins', array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_plugins'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('context' => array('default' => 'select-options')))); }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $version = '1'; $namespace = 'ngpress/v' . $version; $base = 'url-to-content'; register_rest_route($namespace, '/' . $base, array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'))); }
/** * Register routes * * @since 0.4.0 */ public function register_routes() { parent::register_routes(); $namespace = $this->make_namespace(); $base = $this->base(); register_rest_route($namespace, '/' . $base . '/(?P<id>[\\d]+)/stats', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_stats'), 'permission_callback' => array($this, 'get_item_permissions_check'), 'args' => array()))); }
function __construct() { if (!function_exists('pmpro_getMembershipLevelForUser')) { return; } add_action('rest_api_init', function () { register_rest_route('makerspace', '/checkin', array('methods' => array('POST', 'GET'), 'callback' => array('MakerspaceOpen', 'member_checkin'))); register_rest_route('makerspace', '/checkout', array('methods' => array('POST', 'GET'), 'callback' => array('MakerspaceOpen', 'member_checkout'))); register_rest_route('makerspace', '/members', array('methods' => 'GET', 'callback' => array('MakerspaceOpen', 'get_members'))); }); // Profile fields add_action('show_user_profile', array($this, 'profile_fields')); add_action('edit_user_profile', array($this, 'profile_fields')); add_action('personal_options_update', array($this, 'save_profile_fields')); add_action('edit_user_profile_update', array($this, 'save_profile_fields')); // Auto checkout cron job add_action('makerspace_auto_checkout', array($this, 'auto_checkout')); add_filter('cron_schedules', array($this, 'auto_checkout_cron_schedule')); if (!wp_next_scheduled('makerspace_auto_checkout')) { wp_schedule_event(time(), 'makerspace_auto_checkout_schedule', 'makerspace_auto_checkout'); } // Key saving and authentication add_filter('rest_authentication_errors', array($this, 'key_authentication')); add_action('pmpro_after_change_membership_level', array($this, 'new_member_key')); // Admin bar checkin add_action('wp_before_admin_bar_render', array($this, 'admin_bar_menu'), 99); add_action('wp_enqueue_scripts', array($this, 'scripts')); }
/** * OauthLoginRoute constructor. * @param SettingsPage $settings */ public function __construct(SettingsPage $settings) { $this->settings = $settings; add_action('rest_api_init', function () { register_rest_route($this->get_route_namespace(), self::USER_CALLBACK_ROUTE, ['methods' => 'POST', 'callback' => [$this, 'update_user_callback']]); }); }
public function register_routes($server) { register_rest_route('wpeci', '/invoices', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_invoices'), 'permission_callback' => array($this, 'check_permissions'), 'args' => array('page' => array('description' => __('Current page of the invoices collection.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint'), 'per_page' => array('description' => __('Maximum number of invoices to be returned in result set.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 10, 'sanitize_callback' => 'absint'), 'customer_id' => array('description' => __('Customer ID of the customer the invoices belong to.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 0, 'sanitize_callback' => 'absint'), 'year' => array('description' => __('Year of the invoices.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 0, 'sanitize_callback' => 'absint'), 'month' => array('description' => __('Month of the invoices.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 0, 'sanitize_callback' => 'absint'))), 'schema' => array($this, 'get_invoice_schema'))); register_rest_route('wpeci', '/invoices/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_invoice'), 'permission_callback' => array($this, 'check_permissions')), 'schema' => array($this, 'get_invoice_schema'))); register_rest_route('wpeci', '/customers', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_customers'), 'permission_callback' => array($this, 'check_permissions'), 'args' => array('page' => array('description' => __('Current page of the customers collection.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint'), 'per_page' => array('description' => __('Maximum number of customers to be returned in result set.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 10, 'sanitize_callback' => 'absint'), 'country_id' => array('description' => __('Country ID of the country the customers belong to.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 0, 'sanitize_callback' => 'absint'), 'year' => array('description' => __('Year when the customers were registered.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 0, 'sanitize_callback' => 'absint'), 'month' => array('description' => __('Month when the customers were registered.', 'easy-customer-invoices'), 'type' => 'integer', 'default' => 0, 'sanitize_callback' => 'absint'))), 'schema' => array($this, 'get_customer_schema'))); register_rest_route('wpeci', '/customers/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_customer'), 'permission_callback' => array($this, 'check_permissions')), 'schema' => array($this, 'get_customer_schema'))); }
public function register_routes() { // GET SMS register_rest_route('assistant/v1', '/sms', array('methods' => 'GET', 'callback' => array($this, 'GET_sms'))); // POST Message register_rest_route('assistant/v1', '/sms', array('methods' => 'POST', 'callback' => array($this, 'POST_sms'))); }
function rest_api_init() { register_rest_route('bne/v1', 'preregister/(?P<id>\\d+)', array('method' => WP_REST_Server::READABLE, 'callback' => array($this, 'preregister'))); register_rest_route('bne/v1', 'register/(?P<id>\\d+)/(?P<lat>\\d+\\.\\d+)/(?P<long>[+-]\\d+\\.\\d+)/(?P<nonce>\\w+)', array('method' => WP_REST_Server::READABLE, 'callback' => array($this, 'register'))); register_rest_route('bne/v1', 'unit/(?P<post_id>\\d+)/(?P<number>\\d+)/(?P<nonce>\\w+)', array('method' => WP_REST_Server::READABLE, 'callback' => array($this, 'unit_number'))); register_rest_route('bne/v1', 'push/(?P<post_id>\\d+)/(?P<key>\\d+)/(?P<nonce>\\w+)', array('method' => WP_REST_Server::READABLE, 'callback' => array($this, 'push_key'))); }
/** * Register REST routes. */ public function register() { // Register fetch config. register_rest_route(self::REST_NAMESPACE, self::ENDPOINT_RETRIEVE, array('methods' => 'GET', 'callback' => array($this->service, 'get_configuration'), 'permission_callback' => array($this, 'can_retrieve_data'))); // Register save changes. register_rest_route(self::REST_NAMESPACE, self::ENDPOINT_STORE, array('methods' => 'PUT', 'callback' => array($this->service, 'set_configuration'), 'permission_callback' => array($this, 'can_save_data'))); }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $version = '1'; $namespace = 'webwork/v' . $version; $base = 'problems'; register_rest_route($namespace, '/' . $base . '/?', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)))); }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $query_params = $this->get_collection_params(); register_rest_route('wp/v2', '/users', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'), 'args' => $query_params), array('methods' => WP_REST_Server::CREATABLE, 'callback' => array($this, 'create_item'), 'permission_callback' => array($this, 'create_item_permissions_check'), 'args' => array_merge($this->get_endpoint_args_for_item_schema(WP_REST_Server::CREATABLE), array('password' => array('required' => true)))), 'schema' => array($this, 'get_public_item_schema'))); register_rest_route('wp/v2', '/users/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_item_permissions_check'), 'args' => array('context' => array('default' => 'embed'))), array('methods' => WP_REST_Server::EDITABLE, 'callback' => array($this, 'update_item'), 'permission_callback' => array($this, 'update_item_permissions_check'), 'args' => array_merge($this->get_endpoint_args_for_item_schema(WP_REST_Server::EDITABLE), array('password' => array()))), array('methods' => WP_REST_Server::DELETABLE, 'callback' => array($this, 'delete_item'), 'permission_callback' => array($this, 'delete_item_permissions_check'), 'args' => array('force' => array('default' => false), 'reassign' => array())), 'schema' => array($this, 'get_public_item_schema'))); register_rest_route('wp/v2', '/users/me', array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_current_item'), 'args' => array('context' => array()), 'schema' => array($this, 'get_public_item_schema'))); }
/** * Register the routes for the objects of the controller. * * @since 1.0.0 */ public function __construct() { register_rest_route('cf', '/forms', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_forms'), 'args' => array('context' => array('default' => 'view'))))); register_rest_route('cf', '/forms/(?<id>[^/]+)', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_form'), 'args' => array('context' => array('default' => 'view'))))); register_rest_route('cf', '/forms/(?<id>[^/]+)/fields', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_fields'), 'args' => array('context' => array('default' => 'view'))))); register_rest_route('cf', '/forms/(?<id>[^/]+)/fields/(?<field>[^/]+)', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_field'), 'args' => array('context' => array('default' => 'view'))))); }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $base = $this->base; register_rest_route($this->namespace, '/' . $base, array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_member_units'), 'permission_callback' => array($this, 'get_units_permissions_check')), array('methods' => WP_REST_Server::CREATABLE, 'callback' => array($this, 'create_member_unit'), 'permission_callback' => array($this, 'get_units_permissions_check')))); register_rest_route($this->namespace, '/' . $base . '/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_member_unit'), 'permission_callback' => array($this, 'get_units_permissions_check'), 'args' => array('context' => $this->get_context_param(array('default' => 'view')))), array('methods' => WP_REST_Server::DELETABLE, 'callback' => array($this, 'delete_member_unit'), 'permission_callback' => array($this, 'get_units_permissions_check'), 'args' => array('force' => array('default' => false))))); /* register_rest_route($this->namespace, '/' . $this->base_type, array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_unit_types' ), 'permission_callback' => array( $this, 'get_units_permissions_check' ), ), ) ); register_rest_route($this->namespace, '/' . $this->base_type . '/(?P<id>[\d]+)', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_unit_type' ), 'permission_callback' => array( $this, 'get_units_permissions_check' ), 'args' => array( 'context' => $this->get_context_param( array( 'default' => 'view' ) ), ), ), ) ); */ }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $base = $this->base; register_rest_route($this->namespace, '/' . $base, array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_ship_manufacturers'), 'permission_callback' => array($this, 'get_units_permissions_check')))); register_rest_route($this->namespace, '/' . $base . '/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_ship_manufacturer'), 'permission_callback' => array($this, 'get_units_permissions_check'), 'args' => array('context' => $this->get_context_param(array('default' => 'view')))))); /* register_rest_route($this->namespace, '/' . $this->base_type, array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_unit_types' ), 'permission_callback' => array( $this, 'get_units_permissions_check' ), ), ) ); register_rest_route($this->namespace, '/' . $this->base_type . '/(?P<id>[\d]+)', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_unit_type' ), 'permission_callback' => array( $this, 'get_units_permissions_check' ), 'args' => array( 'context' => $this->get_context_param( array( 'default' => 'view' ) ), ), ), ) ); */ }
/** * Add the "used" route * * @since 0.3.0 * * @access protected */ protected function register_more_routes() { $namespace = $this->make_namespace(); $base = $this->base(); register_rest_route($namespace, '/' . $base . '/(?P<id>[\\d]+)/tests', array(array('methods' => \WP_REST_Server::CREATABLE, 'callback' => array($this, 'session'), 'permission_callback' => array($this, 'verify_session_nonce'), 'args' => $this->args()))); register_rest_route($namespace, '/' . $base . '/(?P<id>[\\d]+)/track', array(array('methods' => \WP_REST_Server::CREATABLE, 'callback' => array($this, 'update'), 'permission_callback' => array($this, 'verify_session_nonce'), 'args' => array('ingot_session_nonce' => array('type' => 'string', 'required' => true), 'click_url' => array('type' => 'string', 'required' => true, 'sanitize_callback' => 'esc_url_raw'))))); }
/** * Register the routes for the objects of the controller. * * @since 0.2.0 */ public function register_routes() { $namespace = $this->make_namespace(); $base = $this->what; register_rest_route($namespace, '/' . $base, array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'read'), 'permission_callback' => array($this, 'permissions_check'), 'args' => $this->args(false)), array('methods' => \WP_REST_Server::EDITABLE, 'callback' => array($this, 'update'), 'permission_callback' => array($this, 'permissions_check'), 'args' => $this->args(false)))); register_rest_route($namespace, '/' . $base . '/page-search', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'page_search'), 'permission_callback' => array($this, 'permissions_check'), 'args' => array('search' => array('default' => '', 'sanitize_callback' => 'sanitize_text_field'))))); }
public function routes() { include_once 'config/routes.php'; foreach ($routes as $route) { register_rest_route('v1', $route['url'], array('methods' => $route['methods'], 'callback' => array('CreativeLittleChurch\\' . $route['controller'], $route['action']))); } }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $base = $this->get_post_type_base($this->post_type); $posts_args = array('context' => array('default' => 'view'), 'page' => array('default' => 1, 'sanitize_callback' => 'absint'), 'per_page' => array('default' => 10, 'sanitize_callback' => 'absint'), 'filter' => array()); register_rest_route('wp/v2', '/' . $base, array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => $posts_args), array('methods' => WP_REST_Server::CREATABLE, 'callback' => array($this, 'create_item'), 'permission_callback' => array($this, 'create_item_permissions_check'), 'args' => $this->get_endpoint_args_for_item_schema(true)), 'schema' => array($this, 'get_public_item_schema'))); register_rest_route('wp/v2', '/' . $base . '/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_item_permissions_check'), 'args' => array('context' => array('default' => 'view'))), array('methods' => WP_REST_Server::EDITABLE, 'callback' => array($this, 'update_item'), 'permission_callback' => array($this, 'update_item_permissions_check'), 'args' => $this->get_endpoint_args_for_item_schema(false)), array('methods' => WP_REST_Server::DELETABLE, 'callback' => array($this, 'delete_item'), 'permission_callback' => array($this, 'delete_item_permissions_check'), 'args' => array('force' => array('default' => false))), 'schema' => array($this, 'get_public_item_schema'))); }
/** * Register routes * * @since 0.4.0 */ public function register_routes() { $namespace = $this->make_namespace(); $base = $this->base(); register_rest_route($namespace, '/' . $base . '/(?P<id>[\\d]+)/conversion', array(array('methods' => \WP_REST_Server::CREATABLE, 'callback' => array($this, 'conversion'), 'permission_callback' => array($this, 'check_session_nonce'), 'args' => $this->win_args()))); register_rest_route($namespace, '/' . $base . '/(?P<id>[\\d]+)', array(array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'check_session_nonce'), 'args' => array('context' => array('default' => 'view'), 'id' => array('description' => __('ID of variant', 'ingot'), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint', 'required' => true), 'ingot_session_nonce' => array('type' => 'string', 'required' => true, 'default' => '0'))))); }
/** * Register the routes for the objects of the controller. */ public function register_routes() { $base = $this->posts_controller->get_post_type_base($this->post_type); $tax_base = $this->terms_controller->get_taxonomy_base($this->taxonomy); register_rest_route('wp/v2', sprintf('/%s/(?P<post_id>[\\d]+)/%s', $base, $tax_base), array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => $this->get_collection_params()), 'schema' => array($this, 'get_public_item_schema'))); register_rest_route('wp/v2', sprintf('/%s/(?P<post_id>[\\d]+)/%s/(?P<term_id>[\\d]+)', $base, $tax_base), array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('context' => $this->get_context_param(array('default' => 'view')))), array('methods' => WP_REST_Server::CREATABLE, 'callback' => array($this, 'create_item'), 'permission_callback' => array($this, 'manage_item_permissions_check')), array('methods' => WP_REST_Server::DELETABLE, 'callback' => array($this, 'delete_item'), 'permission_callback' => array($this, 'manage_item_permissions_check'), 'args' => array('force' => array('default' => false))), 'schema' => array($this, 'get_public_item_schema'))); }
/** * Register menu routes for WP API v2. * * @since 1.2.0 */ public function register_routes() { register_rest_route(self::get_plugin_namespace(), '/menus', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_menus')))); register_rest_route(self::get_plugin_namespace(), '/menus/(?P<id>\\d+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_menu'), 'args' => array('context' => array('default' => 'view'))))); register_rest_route(self::get_plugin_namespace(), '/menu-locations', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_menu_locations')))); register_rest_route(self::get_plugin_namespace(), '/menu-locations/(?P<location>[a-zA-Z0-9_-]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_menu_location')))); }
public function register_routes() { $version = '2'; $namespace = 'wp/v' . $version; register_rest_route($namespace, '/users/login/(?P<username>[\\w-]+)', array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item_username'), 'args' => array('context' => $this->get_context_param(array('default' => 'embed'))), 'schema' => array($this, 'get_public_item_schema'))); register_rest_route($namespace, '/users/email/(?P<email>[\\S-]+)', array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item_username'), 'args' => array('context' => $this->get_context_param(array('default' => 'embed'))), 'schema' => array($this, 'get_public_item_schema'))); }