started with wp-rest-api-event plugin

This commit is contained in:
Vitaly Strizhenok
2019-10-18 11:55:56 +03:00
parent d7fe90d11f
commit 33d9028868
6 changed files with 221 additions and 0 deletions

View File

@@ -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();