forked from amareshjoshi/orcid-data-block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorcid-data-block.php
63 lines (56 loc) · 1.85 KB
/
orcid-data-block.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
<?php
/**
* Plugin Name: ORCID Data Block
* Plugin URI: https://meshresearch.net/
* Description: Add ORCID data to your site using shortcodes and the block editor.
* Requires at least: 5.9
* Tested up to: 6.4.3
* Requires PHP: 8.0
* Version: 1.0.0
* Author: Amaresh R Joshi
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: orcid-data-block
* Version: 1.0.0 1.0.0
*
* @package OrcidDataBlock
*/
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
if (!extension_loaded('xsl')) {
add_action('plugins_loaded', 'orcid_data_block_init_deactivation');
/**
* Schedule the plugin to be deactivated if the PHP XSLT extension is not enabled.
*
* @return void
*/
function orcid_data_block_init_deactivation() {
if (current_user_can('activate_plugins')) {
add_action('admin_init', 'orcid_data_block_deactivate');
add_action('admin_notices', 'orcid_data_block_admin_notice');
}
/**
* Deactivate the plugin.
*
* @return void
*/
function orcid_data_block_deactivate() {
deactivate_plugins(plugin_basename(__FILE__));
}
/**
* Display an admin notice explaining why the plugin was deactivated.
*
* @return void
*/
function orcid_data_block_admin_notice() {
$notice = '<strong>' . __('ORCID Data requires the PHP XSL extension to be enabled. It is not enabled, so the plugin has been deactivated.', 'orcid-data-block') . '</strong>';
?>
<div class="updated"><p><?php echo $notice; ?></p></div>
<?php
}
}
return false;
}
require plugin_dir_path(__FILE__) . '/init.php';