PluginProbe
Document Embedder – let visitors read files without downloading / 2.1.2
Document Embedder – let visitors read files without downloading v2.1.2
2.3.1 2.3.0 2.2.1 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.3 1.7.4 1.7.6 1.7.9 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 2.0.0 2.0.1 2.0.2 All 30 releases
document-emberdder / includes / features / class-bplde-blocks.php

class-bplde-blocks.php in Document Embedder – let visitors read files without downloading 2.1.2, at includes/features/class-bplde-blocks.php

63 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * BPLDE Gutenberg Blocks registration class.
4 *
5 * @package DocumentEmbedder
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 if (!class_exists('BPLDE_Block')) {
13 class BPLDE_Block {
14 public function __construct() {
15 add_action('init', [$this, 'init']);
16 add_action('enqueue_block_assets', [$this, 'bplde_block_assets']);
17 }
18
19 public function init()
20 {
21 wp_register_script('ppv-blocks', BPLDE_PLUGIN_DIR . 'build/editor.js', array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor', 'jquery'), BPLDE_VER, true);
22
23 wp_localize_script('ppv-blocks', 'ppvBlocks', [
24 'siteUrl' => site_url(),
25 'ajaxUrl' => admin_url('admin-ajax.php'),
26 'ppv_nonce' => wp_create_nonce('ppv_secret_nonce')
27 ]);
28
29 register_block_type(BPLDE_PLUGIN_PATH . 'build/blocks/document-embedder');
30
31 register_block_type('kahf-kit/kahf-banner-k27f', array(
32 'editor_script' => 'ppv-blocks',
33 'render_callback' => function ($attr, $content) {
34 return wpautop($content);
35 }
36 ));
37
38 // Document library block registration
39 register_block_type(BPLDE_PLUGIN_PATH . 'build/blocks/document-library');
40 wp_set_script_translations('document-emberdder', 'document-library', plugin_dir_path(BPLDE__FILE__) . 'languages');
41 }
42
43 public function bplde_block_assets() {
44 wp_localize_script(
45 'bpldl-document-library-editor-script',
46 'bpldlData',
47 [
48 'ajax_url' => admin_url('admin-ajax.php'),
49 'nonce' => wp_create_nonce('bplde_nonce')
50 ]
51 );
52 wp_localize_script(
53 'bpldl-document-library-view-script',
54 'bpldlData',
55 [
56 'ajax_url' => admin_url('admin-ajax.php'),
57 'nonce' => wp_create_nonce('bplde_nonce')
58 ]
59 );
60 }
61 }
62 }
63