PluginProbe
PDF Embed Block – share documents right inside your posts / trunk
PDF Embed Block – share documents right inside your posts vtrunk
1.3.3 1.3.2 1.3.1 1.3.0 trunk 1.0.0 1.0.1 1.0.2 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5
pdf-embed-block / includes / Init.php

Init.php in PDF Embed Block – share documents right inside your posts trunk, at includes/Init.php

63 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PEB;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 class Init {
10 function __construct() {
11 add_action( 'init', [ $this, 'onInit' ] );
12 }
13
14 function onInit() {
15
16 register_setting(
17 'pebPluginSettings',
18 'pebAPIKey',
19 [
20 'default' => '',
21 'show_in_rest' => true,
22 'type' => 'string'
23 ]
24 );
25
26 register_block_type( PEB_DIR_PATH . '/build/pdf-embed' );
27
28 register_post_type('pdf_embed', [
29 'label' => __('PDF Embeds', 'pdf-embed-block'),
30 'labels' => [
31 'name' => __('PDF Embeds', 'pdf-embed-block'),
32 'singular_name' => __('PDF Embed', 'pdf-embed-block'),
33 'add_new' => __('Add New', 'pdf-embed-block'),
34 'add_new_item' => __('Add New PDF Embed', 'pdf-embed-block'),
35 'edit_item' => __('Edit PDF Embed', 'pdf-embed-block'),
36 'new_item' => __('New PDF Embed', 'pdf-embed-block'),
37 'view_item' => __('View PDF Embed', 'pdf-embed-block'),
38 'view_items' => __('View PDF Embeds', 'pdf-embed-block'),
39 'search_items' => __('Search PDF Embeds', 'pdf-embed-block'),
40 'not_found' => __('No PDF Embeds found.', 'pdf-embed-block'),
41 'not_found_in_trash' => __('No PDF Embeds found in Trash.', 'pdf-embed-block'),
42 'all_items' => __('All PDF Embeds', 'pdf-embed-block'),
43 'archives' => __('PDF Embed Archives', 'pdf-embed-block'),
44 ],
45 'show_in_rest' => true,
46 'public' => true,
47 'publicly_queryable' => false,
48 'item_published' => 'PDF Embed Block Published',
49 'item_updated' => 'PDF Embed Block Updated',
50 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('
51 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
52 <rect width="512" height="512" rx="15%" fill="var(--wp-admin-theme-color)" />
53 <path d="M413 302c-9-10-29-15-56-15-16 0-33 2-53 5a252 252 0 0 1-52-69c10-30 17-59 17-81 0-17-6-44-30-44-7 0-13 4-17 10-10 18-6 58 13 100a898 898 0 0 1-50 117c-53 22-88 46-91 65-2 9 4 24 25 24 31 0 65-45 91-91a626 626 0 0 1 92-24c38 33 71 38 87 38 32 0 35-23 24-35z" />
54 </svg>
55 '),
56 'template' => [['peb/pdf-embed']],
57 'template_lock' => 'all',
58 ]);
59
60 wp_set_script_translations( 'peb-pdf-embed-editor-script', 'pdf-embed-block', PEB_DIR_PATH . 'languages' );
61 }
62
63 }