Skip to content

Commit f98cb4c

Browse files
committed
add: Main plugin file with initialization hook
1 parent 594c47f commit f98cb4c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

abilities-api.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Plugin Name: Abilities API
4+
* Plugin URI: https://github.com/WordPress/abilities-api
5+
* Description: Provides a standardized API for registering and executing abilities in WordPress
6+
* Version: 0.1.0
7+
* Author: WordPress Contributors
8+
* License: GPL v2 or later
9+
* Text Domain: abilities-api
10+
*
11+
* @package Abilities_API
12+
*/
13+
14+
// Prevent direct access
15+
if ( ! defined( 'ABSPATH' ) ) {
16+
exit;
17+
}
18+
19+
// TODO: https://github.com/WordPress/abilities-api/pull/4/ also contains this
20+
21+
// Load plugin files
22+
require_once __DIR__ . '/src/class-wp-ability.php';
23+
require_once __DIR__ . '/src/class-wp-abilities-registry.php';
24+
require_once __DIR__ . '/src/abilities-api.php';
25+
require_once __DIR__ . '/src/rest/class-wp-rest-abilities-init.php';
26+
27+
/**
28+
* Initialize the Abilities API.
29+
*
30+
* @since 0.1.0
31+
*/
32+
function abilities_api_init() {
33+
/**
34+
* Fires when the Abilities API is ready to register abilities.
35+
*
36+
* @since 0.1.0
37+
*/
38+
do_action( 'abilities_api_init' );
39+
}
40+
add_action( 'init', 'abilities_api_init', 0 );

0 commit comments

Comments
 (0)