forked from pods-framework/pods-json-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader.php
82 lines (72 loc) · 2.27 KB
/
loader.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
<?php
/*
Plugin Name: BP API
Plugin URI: https://github.com/modemlooper/bp-api
Description: json API for BuddyPress. This plugin creates json api endpoints for https://github.com/WP-API
Author: modemlooper, djpaul
Version: 0.1
Author URI: https://github.com/modemlooper/bp-api
*/
// Define a constant that can be checked to see if the component is installed or not.
define( 'BP_API_IS_INSTALLED', 1 );
// Define a constant that will hold the current version number of the component
// This can be useful if you need to run update scripts or do compatibility checks in the future
define( 'BP_API_VERSION', '0.1' );
// Define a constant that we can use to construct file paths throughout the component
define( 'BP_API_PLUGIN_DIR', dirname( __FILE__ ) );
// is BuddyPress plugin active? If not, throw a notice and deactivate
if ( ! in_array( 'buddypress/bp-loader.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
add_action( 'all_admin_notices', 'bp_api_buddypress_required' );
return;
}
/**
* bp_api_init function.
*
* @access public
* @return void
*/
/**
* Loads component into the $bp global
*
*/
function bp_api_load_core_component() {
if ( version_compare( BP_VERSION, '2.0', '>' ) )
require_once( dirname( __FILE__ ) . '/includes/bp-api-loader.php' );
}
add_action( 'bp_setup_components', 'bp_api_load_core_component', 6 );
/*
function bp_api_init() {
// requires BP 2.0 or greater.
if ( version_compare( BP_VERSION, '2.0', '>' ) )
require( dirname( __FILE__ ) . '/includes/bp-api-loader.php' );
}
add_action( 'bp_include', 'bp_api_init' );
*/
/**
* bp_api_activate function.
*
* @access public
* @return void
*/
function bp_api_activate() {
}
register_activation_hook( __FILE__, 'bp_api_activate' );
/**
* bp_api_deactivate function.
*
* @access public
* @return void
*/
function bp_api_deactivate() {
}
register_deactivation_hook( __FILE__, 'bp_api_deactivate' );
/**
* bp_api_buddypress_required function.
*
* @access public
* @return void
*/
function bp_api_buddypress_required() {
echo '<div id="message" class="error"><p>'. sprintf( __( '%1$s requires the BuddyPress plugin to be installed/activated. %1$s has been deactivated.', 'appbuddy' ), 'BuddyPress json API' ) .'</p></div>';
deactivate_plugins( plugin_basename( __FILE__ ), true );
}