C:\xampp\htdocs\landing\wp-content\plugins\instant-images\api\test.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
 * Custom /resize route
 *
 * @since 3.0
 * @author dcooney
 * @package instant-images
 */

add_action'rest_api_init', function () {
    
$my_namespace 'instant-images';
    
$my_endpoint  '/test';
    
register_rest_route(
        
$my_namespace,
        
$my_endpoint,
        array(
            
'methods'             => 'POST',
            
'callback'            => 'instant_images_test',
            
'permission_callback' => function () {
                return 
InstantImages::instant_img_has_access();
            },
        )
    );
});

/**
 * Test REST API access
 *
 * @param WP_REST_Request $request API request.
 * @since 3.2
 * @author dcooney
 * @package instant-images
 */
function instant_images_testWP_REST_Request $request ) {

    if ( 
InstantImages::instant_img_has_access() ) {

        
// Access is enable, send the response.
        
$response = array( 'success' => true );

        
// Send response as JSON.
        
wp_send_json$response );
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586