This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
forked from 10up/publisher-media-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publisher-media-kit.php
executable file
·102 lines (92 loc) · 3.19 KB
/
publisher-media-kit.php
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* Plugin Name: Publisher Media Kit for Newspack
* Plugin URI: https://github.com/Automattic/publisher-media-kit-for-newspack
* Description: Pre-configured Media Kit Page using Gutenberg Block Patterns.
* Version: 2.0
* Requires at least: 6.5
* Requires PHP: 7.4
* Author: 10up, Automattic
* Author URI: https://automattic.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: publisher-media-kit
* Domain Path: /languages
*
* @package PublisherMediaKit
*/
// Useful global constants.
define( 'PUBLISHER_MEDIA_KIT_VERSION', '2.0' );
define( 'PUBLISHER_MEDIA_KIT_URL', plugin_dir_url( __FILE__ ) );
define( 'PUBLISHER_MEDIA_KIT_PATH', plugin_dir_path( __FILE__ ) );
define( 'PUBLISHER_MEDIA_KIT_BLOCKS_PATH', plugin_dir_path( __FILE__ ) . 'includes/blocks/block-editor/' );
define( 'PUBLISHER_MEDIA_KIT_INC', PUBLISHER_MEDIA_KIT_PATH . 'includes/' );
define( 'PUBLISHER_MEDIA_KIT_BLOCK_PATTERS', PUBLISHER_MEDIA_KIT_PATH . 'includes/block-patterns/' );
/**
* Get the minimum version of PHP required by this plugin.
*
* @return string Minimum version required.
*/
function pmk_minimum_php_requirement() {
return '7.4';
}
/**
* Checks whether PHP installation meets the minimum requirements.
*
* @return bool true if meets minimum requirements, false otherwise.
*/
function pmk_site_meets_php_requirements() {
return version_compare( phpversion(), pmk_minimum_php_requirement(), '>=' );
}
// Check minimum PHP version.
if ( ! pmk_site_meets_php_requirements() ) {
add_action(
'admin_notices',
function() {
?>
<div class="notice notice-error">
<p>
<?php
echo wp_kses_post(
sprintf(
/* translators: %s: Minimum required PHP version */
__( 'Publisher Media Kit requires PHP version %s or later. Please upgrade PHP or disable the plugin.', 'publisher-media-kit' ),
esc_html( pmk_minimum_php_requirement() )
)
);
?>
</p>
</div>
<?php
}
);
return;
}
// Require Composer autoloader if it exists.
if ( file_exists( PUBLISHER_MEDIA_KIT_PATH . 'vendor/autoload.php' ) ) {
require_once PUBLISHER_MEDIA_KIT_PATH . 'vendor/autoload.php';
}
// Include files.
require_once PUBLISHER_MEDIA_KIT_INC . '/core.php';
// Block Editor
require_once PUBLISHER_MEDIA_KIT_INC . '/blocks.php';
// Activation/Deactivation.
register_activation_hook( __FILE__, '\PublisherMediaKit\Core\activate' );
register_deactivation_hook( __FILE__, '\PublisherMediaKit\Core\deactivate' );
// Bootstrap.
PublisherMediaKit\Core\setup();
// Blocks
PublisherMediaKit\Blocks\setup();
/*
* Please note the lowercase B in the blocks portion of the namespace.
*
* Due to an earlier typo in the blocks folder name (it uses a lower case b),
* that part of the namespace is lowercase. This is to avoid breaking existing
* code that may be referencing this file directly.
*
* Namespaces are case insensitive whereas file systems can be case sensitive so
* the namespace case was modified to match the folder name.
*
* @see https://github.com/10up/publisher-media-kit/issues/118
*/
PublisherMediaKit\blocks\BlockContext\Tabs::get_instance()->setup();