-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblockparty-post-sharing.php
More file actions
76 lines (65 loc) · 2.11 KB
/
Copy pathblockparty-post-sharing.php
File metadata and controls
76 lines (65 loc) · 2.11 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* Plugin Name: Blockparty Post Sharing
* Description: Add a block to copy and share the current post URL.
* Version: 1.1.0
* Requires at least: 6.8
* Requires PHP: 8.1
* Author: Be API Technical Team
* Author URI: https://beapi.fr
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: blockparty-post-sharing
* Domain Path: /languages
*
* @package Blockparty\PostSharing
*/
namespace Blockparty\PostSharing;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
} else {
require_once __DIR__ . '/includes/BlockRenderer.php';
require_once __DIR__ . '/includes/ResponsiveDisplay.php';
require_once __DIR__ . '/includes/ShareNetworks.php';
}
define( 'BLOCKPARTY_POST_SHARING_VERSION', '1.1.0' );
define( 'BLOCKPARTY_POST_SHARING_URL', plugin_dir_url( __FILE__ ) );
define( 'BLOCKPARTY_POST_SHARING_DIR', plugin_dir_path( __FILE__ ) );
define( 'BLOCKPARTY_POST_SHARING_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
/**
* Bootstrap the plugin.
*/
function init() {
load_plugin_textdomain(
'blockparty-post-sharing',
false,
dirname( BLOCKPARTY_POST_SHARING_PLUGIN_BASENAME ) . '/languages'
);
register_block_type(
BLOCKPARTY_POST_SHARING_DIR . 'build/blockparty-post-sharing',
[
'render_callback' => [ BlockRenderer::class, 'render' ],
]
);
wp_set_script_translations(
'blockparty-post-sharing-button-editor-script',
'blockparty-post-sharing',
BLOCKPARTY_POST_SHARING_DIR . 'languages'
);
wp_set_script_translations(
'blockparty-post-sharing-button-view-script',
'blockparty-post-sharing',
BLOCKPARTY_POST_SHARING_DIR . 'languages'
);
}
add_action( 'init', __NAMESPACE__ . '\\init', 0 );
/**
* Enqueue responsive display styles in the editor and on the front end.
*/
function enqueue_responsive_display_styles() {
ResponsiveDisplay::enqueue_styles();
}
add_action( 'enqueue_block_assets', __NAMESPACE__ . '\\enqueue_responsive_display_styles' );