-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
121 lines (112 loc) · 3.28 KB
/
Copy pathfunctions.php
File metadata and controls
121 lines (112 loc) · 3.28 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* EvolveWP PredictiveERP global helper functions.
*
* ROLE: Global accessor functions for namespaced classes.
* DEPENDS ON: EvolveWP\PredictiveERP\ namespaced classes via Composer autoloader.
* CONSUMED BY: Any plugin or template that needs the ecosystem registry or main instance.
* DATA FLOW: Provides shorthand access to singleton instances.
*
* @package EvolveWP\PredictiveERP
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Return the main EvolveWP PredictiveERP plugin instance.
*
* Shorthand for EvolveWPPredictiveERP::instance(). Prevents the need to use
* globals anywhere in the codebase.
*
* @since 1.0.0
*
* @return EvolveWPPredictiveERP
*/
function EvolveWPPredictiveERP() {
return EvolveWPPredictiveERP::instance();
}
/**
* Return the ecosystem Registry singleton.
*
* Global accessor for \EvolveWP\PredictiveERP\Ecosystem\Registry.
*
* @since 1.0.0
*
* @return \EvolveWP\PredictiveERP\Ecosystem\Registry
*/
function evolvewp_erp_ecosystem() {
return \EvolveWP\PredictiveERP\Ecosystem\Registry::instance();
}
/**
* Return the structured Logger singleton.
*
* Global accessor for \EvolveWP\PredictiveERP\Core\Logger.
*
* @since 1.0.0
*
* @return \EvolveWP\PredictiveERP\Core\Logger
*/
function evolvewp_erp_log() {
return \EvolveWP\PredictiveERP\Core\Logger::instance();
}
/**
* Record a trace entry via the structured Logger.
*
* Convenience shorthand for evolvewp_erp_log()->trace().
*
* @since 1.0.0
*
* @param string $type Trace type.
* @param string $message Description.
* @param array $data Optional structured data.
*
* @return void
*/
function evolvewp_erp_trace( $type, $message, $data = array() ) {
\EvolveWP\PredictiveERP\Core\Logger::instance()->trace( $type, $message, $data );
}
/**
* Create or retrieve an API connector instance.
*
* Global accessor for EvolveWP_ERP_API_Factory::create_from_settings().
*
* @since 1.0.0
*
* @param string $provider_id Provider identifier (e.g. 'github', 'discord').
* @param string $account_id Optional. Account identifier for multi-account setups.
*
* @return \EvolveWP\PredictiveERP\API\Connector_Interface|\WP_Error Connector instance or error.
*/
function evolvewp_erp_connector( $provider_id, $account_id = '' ) {
return EvolveWP_ERP_API_Factory::create_from_settings( $provider_id, $account_id );
}
/**
* Check whether a user has a specific capability.
*
* Global accessor for \EvolveWP\PredictiveERP\Core\Capability_Manager::user_can().
*
* @since 1.0.0
*
* @param string $capability Capability name to check.
* @param int|null $user_id User ID to check. Null = current user.
*
* @return bool True if the user has the capability.
*/
function evolvewp_erp_user_can( $capability, $user_id = null ) {
return \EvolveWP\PredictiveERP\Core\Capability_Manager::user_can( $capability, $user_id );
}
/**
* Return all registered REST Bridge endpoints.
*
* Global accessor for \EvolveWP\PredictiveERP\API\REST_Bridge::get_registered_endpoints().
*
* @since 1.0.0
*
* @param string $source Optional. Filter by source: 'manual', 'connector', or empty for all.
*
* @return array Registered endpoint metadata.
*/
function evolvewp_erp_rest_endpoints( $source = '' ) {
return \EvolveWP\PredictiveERP\API\REST_Bridge::get_registered_endpoints( $source );
}