forked from LiveCarta/LiveCartaWP
started with wp-rest-api-event plugin
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: WP-REST-API Event
|
||||
Version: 0.0.1
|
||||
Description:
|
||||
Author:
|
||||
*/
|
||||
|
||||
function wp_rest_api_event_register() {
|
||||
spl_autoload_register(function($class) {
|
||||
$namespace = 'app\\wpRestApiEvent\\';
|
||||
if (false === strpos($class, $namespace)) {
|
||||
return false;
|
||||
}
|
||||
$filename = __DIR__ . '/' . str_replace('\\', '/', str_replace($namespace, '', $class)) . '.php';
|
||||
if (!file_exists($filename)) {
|
||||
return false;
|
||||
}
|
||||
include $filename;
|
||||
return true;
|
||||
});
|
||||
|
||||
\app\wpRestApiEvent\event\EventSubscriber::setGlobals();
|
||||
add_action('init', [\app\wpRestApiEvent\event\EventSubscriber::class, 'onInit']);
|
||||
}
|
||||
|
||||
|
||||
wp_rest_api_event_register();
|
||||
Reference in New Issue
Block a user