PluginProbe
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.4.5
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.4.5
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 All 57 releases
wp-all-export / wpae_api.php
wpae_api.php
33 lines 1009 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Let's bootstrap
4 function wpae_api() {
5
6 if ( ! check_ajax_referer( 'wp_all_export_secure', 'security', false )){
7 exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
8 }
9
10 if ( ! current_user_can( \PMXE_Plugin::$capabilities ) ){
11 exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
12 }
13
14 $container = new \Wpae\Di\WpaeDi(array());
15
16 $request = new \Wpae\Http\Request(file_get_contents('php://input'));
17
18 $q = $_GET['q'];
19 $routeParts = explode('/', $q);
20 $controller = 'Wpae\\App\\Controller\\'.ucwords($routeParts[0]).'Controller';
21 $action = ucwords($routeParts[1]).'Action';
22
23 $controller = new $controller($container);
24 $response = $controller->$action($request);
25
26 if(!$response instanceof \Wpae\Http\Response) {
27 throw new Exception('The controller must return an HttpResponse instance.');
28 }
29
30 $response->render();
31 }
32
33 add_action( 'wp_ajax_wpae_api', 'wpae_api' );