forked from WebDevStudios/WDS-BuddyPress-Project-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.php
More file actions
147 lines (116 loc) · 3.05 KB
/
loader.php
File metadata and controls
147 lines (116 loc) · 3.05 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/*
Plugin Name: BP Project Framework
Plugin URI: https://github.com/WebDevStudios/BP-Project-Framework
Description: A boilerplate for custom BuddyPress development.
Text Domain: buddypress
Domain Path: /languages
Version: 1.0
Author: WDS Team
Author URI: http://webdevstudios.com
License: GPLv2
*/
if ( !defined( 'ABSPATH' ) ) exit;
if ( !class_exists( 'BP_Project_Framework' ) ) :
/**
* BP_Project_Framework class.
*/
class BP_Project_Framework {
/**
* instance function.
*
* @access public
* @static
* @return \BP_Project_Framework $instance
*/
public static function instance() {
// Store the instance locally to avoid private static replication
static $instance = null;
// Only run these methods if they haven't been run previously
if ( null === $instance ) {
$instance = new BP_Project_Framework;
$instance->actions();
}
// Always return the instance
return $instance;
}
/**
* __construct function.
*
* @access private
* @return \BP_Project_Framework
*/
private function __construct() { /* Do nothing here */ }
/**
* actions function.
*
* @access private
* @return void
*/
private function actions() {
add_action( 'bp_include', array( $this, 'includes' ) );
// these are for template file overrides.
add_action( 'bp_register_theme_packages', array( $this, 'bp_custom_templatepack_work' ) );
add_filter( 'pre_option__bp_theme_package_id', array( $this, 'bp_custom_templatepack_package_id' ) );
add_action( 'wp', array( $this, 'bp_templatepack_kill_legacy_js_and_css' ), 999 );
}
/**
* includes function.
*
* @access public
* @return void
*/
public function includes() {
// to include a file place it in the inc directory
foreach( glob( plugin_dir_path(__FILE__) . 'inc/*.php' ) as $filename ) {
include $filename;
}
}
/**
* templatepack_work function.
*
* @access public
* @return void
*/
public function bp_custom_templatepack_work() {
bp_register_theme_package( array(
'id' => 'templates',
'name' => __( 'BuddyPress Templates', 'buddypress' ),
'version' => bp_get_version(),
'dir' => plugin_dir_path( __FILE__ ) . '/templates',
'url' => plugin_dir_url( __FILE__ ) . '/templates'
) );
}
/**
* templatepack_package_id function.
*
* @access public
* @param mixed $package_id
* @return void
*/
public function bp_custom_templatepack_package_id( $package_id ) {
return 'templates';
}
// Proposed BP core change: see http://buddypress.trac.wordpress.org/ticket/3741#comment:43
/**
* templatepack_kill_legacy_js_and_css function.
*
* @access public
* @return void
*/
public function bp_templatepack_kill_legacy_js_and_css() {
wp_dequeue_script( 'groups_widget_groups_list-js' );
wp_dequeue_script( 'bp_core_widget_members-js' );
}
}
/**
* bp_custom_template_stack function.
*
* @access public
* @return void
*/
function bp_project_framework() {
return BP_Project_Framework::instance();
}
bp_project_framework();
endif;