-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheacSoftwareRegistry_Custom_Hooks.php
executable file
·92 lines (85 loc) · 2.86 KB
/
eacSoftwareRegistry_Custom_Hooks.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
<?php
/**
* EarthAsylum Consulting {eac} Software Registration Server - Custom Hooks
*
* @category WordPress Plugin
* @package {eac}SoftwareRegistry Custom Hooks
* @author Kevin Burkholder <KBurkholder@EarthAsylum.com>
* @copyright Copyright (c) 2024 EarthAsylum Consulting <www.earthasylum.com>
* @uses {eac}SoftwareRegistry
*
* @wordpress-plugin
* Plugin Name: {eac}SoftwareRegistry Custom Hooks
* Description: Software Registration Server Custom Hooks - allows coding hooks and customization of the Software Registration Server
* Version: 2.0.12
* Requires at least: 5.8
* Tested up to: 6.7
* Requires PHP: 7.4
* Plugin URI: https://swregistry.earthasylum.com/software-registry-hooks/
* Update URI: https://swregistry.earthasylum.com/software-updates/eacsoftwareregistry-custom-hooks.json
* Author: EarthAsylum Consulting
* Author URI: http://www.earthasylum.com
* License: GPLv3 or later
* License URI: https://www.gnu.org/licenses/gpl.html
* Text Domain: eacSoftwareRegistry
* Domain Path: /languages
*/
/**
* This simple plugin file responds to the 'eacSoftwareRegistry_load_extensions' filter to load additional extensions.
* Using this method prevents overwriting extensions when the plugin is updated or reinstalled.
*/
namespace EarthAsylumConsulting;
class eacSoftwareRegistry_Custom_Hooks
{
/**
* constructor method
*
* @return void
*/
public function __construct()
{
/*
* eacSoftwareRegistry_load_extensions - get the extensions directory to load
*
* @param array $extensionDirectories - array of [plugin_slug => plugin_directory]
* @return array updated $extensionDirectories
*/
add_filter( 'eacSoftwareRegistry_load_extensions', function($extensionDirectories)
{
/*
* Enable update notice (self hosted or wp hosted)
*/
eacSoftwareRegistry::loadPluginUpdater(__FILE__,'self');
/*
* on plugin_action_links_ filter, add 'Settings' link
*/
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ),function($pluginLinks, $pluginFile, $pluginData)
{
return array_merge(
[
'settings' => eacSoftwareRegistry::getSettingsLink($pluginData,'hooks'),
'documentation' => eacSoftwareRegistry::getDocumentationLink($pluginData),
],
$pluginLinks
);
},20,3
);
/*
* Add our extension to load (look in theme folder)
*/
foreach ([\get_stylesheet_directory(),\get_template_directory(),\plugin_dir_path( __FILE__ )] as $customHooks)
{
$customHooks .= '/eacSoftwareRegistry/CustomHooks';
if (is_dir($customHooks)) break;
}
$extensionDirectories[ plugin_basename( __FILE__ ) ] = [
plugin_dir_path( __FILE__ ).'/Extensions',
$customHooks
];
return $extensionDirectories;
}
);
}
}
new \EarthAsylumConsulting\eacSoftwareRegistry_Custom_Hooks();
?>