-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
53 lines (45 loc) · 1.2 KB
/
plugin.php
File metadata and controls
53 lines (45 loc) · 1.2 KB
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
45
46
47
48
49
50
51
52
53
<?php
/**
* Plugin Name: WP Docs Viewer
* Description: A WordPress block plugin to display documentation files.
* Version: 0.1.0
* Requires at least: 6.9
* Requires PHP: 8.3
* Author: Micha Krapp
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-docs-viewer
*
* @package WpDocsViewer
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
// Load autoloader (supports both Composer and standalone usage).
require_once plugin_dir_path( __FILE__ ) . 'lib/autoload.php';
use WpDocsViewer\Admin_Page;
use WpDocsViewer\Docs_Finder;
use WpDocsViewer\REST_API;
// Initialize admin page.
Admin_Page::init();
// Initialize REST API.
REST_API::init();
// Initialize cache invalidation hooks.
Docs_Finder::init_hooks();
/**
* Register the block.
*/
if ( ! function_exists( 'wpdocsviewer_block_init' ) ) {
/**
* Initialize blocks.
*
* @return void
*/
function wpdocsviewer_block_init(): void {
wp_register_block_types_from_metadata_collection(
plugin_dir_path( __FILE__ ) . 'build',
plugin_dir_path( __FILE__ ) . 'build/blocks-manifest.php',
);
}
}
add_action( 'init', 'wpdocsviewer_block_init' );