diff --git bp-core/bp-core-template-loader.php bp-core/bp-core-template-loader.php
index 7887169..05ab2df 100644
|
|
function bp_locate_template( $template_names, $load = false, $require_once = tru |
108 | 108 | * |
109 | 109 | * @param string $location Callback function that returns the stack location |
110 | 110 | * @param int $priority |
| 111 | * @param string $path_type 'dir' for filesystem paths, 'uri' for URI paths |
111 | 112 | */ |
112 | | function bp_register_template_stack( $location_callback = '', $priority = 10 ) { |
| 113 | function bp_register_template_stack( $location_callback = '', $priority = 10, $path_type = 'dir' ) { |
113 | 114 | |
114 | 115 | // Bail if no location, or function does not exist |
115 | | if ( empty( $location_callback ) || ! function_exists( $location_callback ) ) |
| 116 | if ( empty( $location_callback ) || ! is_callable( $location_callback ) ) |
116 | 117 | return false; |
117 | 118 | |
| 119 | $tag = 'uri' === $path_type ? 'bp_template_stack_uri' : 'bp_template_stack'; |
| 120 | |
118 | 121 | // Add location callback to template stack |
119 | | return add_filter( 'bp_template_stack', $location_callback, (int) $priority ); |
| 122 | return add_filter( $tag, $location_callback, (int) $priority ); |
120 | 123 | } |
121 | 124 | |
122 | 125 | /** |
… |
… |
function bp_register_template_stack( $location_callback = '', $priority = 10 ) { |
128 | 131 | * @param int $priority |
129 | 132 | * @see bp_register_template_stack() |
130 | 133 | */ |
131 | | function bp_deregister_template_stack( $location_callback = '', $priority = 10 ) { |
| 134 | function bp_deregister_template_stack( $location_callback = '', $priority = 10, $path_type = 'dir' ) { |
132 | 135 | |
133 | 136 | // Bail if no location, or function does not exist |
134 | | if ( empty( $location_callback ) || ! function_exists( $location_callback ) ) |
| 137 | if ( empty( $location_callback ) || ! is_callable( $location_callback ) ) |
135 | 138 | return false; |
136 | 139 | |
| 140 | $tag = 'uri' === $path_type ? 'bp_template_stack_uri' : 'bp_template_stack'; |
| 141 | |
137 | 142 | // Add location callback to template stack |
138 | | return remove_filter( 'bp_template_stack', $location_callback, (int) $priority ); |
| 143 | return remove_filter( $tag, $location_callback, (int) $priority ); |
139 | 144 | } |
140 | 145 | |
141 | 146 | /** |
… |
… |
function bp_deregister_template_stack( $location_callback = '', $priority = 10 ) |
152 | 157 | * |
153 | 158 | * @return array The filtered value after all hooked functions are applied to it. |
154 | 159 | */ |
155 | | function bp_get_template_stack() { |
| 160 | function bp_get_template_stack( $path_type = 'dir' ) { |
156 | 161 | global $wp_filter, $merged_filters, $wp_current_filter; |
157 | 162 | |
158 | 163 | // Setup some default variables |
159 | | $tag = 'bp_template_stack'; |
| 164 | $tag = 'uri' === $path_type ? 'bp_template_stack_uri' : 'bp_template_stack'; |
160 | 165 | $args = $stack = array(); |
161 | 166 | |
162 | 167 | // Add 'bp_template_stack' to the current filter array |
… |
… |
function bp_get_template_stack() { |
187 | 192 | // Remove empties and duplicates |
188 | 193 | $stack = array_unique( array_filter( $stack ) ); |
189 | 194 | |
190 | | return (array) apply_filters( 'bp_get_template_stack', $stack ) ; |
| 195 | return (array) apply_filters( 'bp_get_template_stack', $stack, $path_type ) ; |
191 | 196 | } |
192 | 197 | |
193 | 198 | /** |
diff --git bp-loader.php bp-loader.php
index 6c138ef..8393a6d 100644
|
|
class BuddyPress { |
256 | 256 | |
257 | 257 | // get network-activated plugins |
258 | 258 | $plugins = get_site_option( 'active_sitewide_plugins'); |
259 | | |
| 259 | |
260 | 260 | // basename |
261 | 261 | $basename = plugin_basename( constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php' ); |
262 | 262 | |
… |
… |
class BuddyPress { |
553 | 553 | bp_register_template_stack( 'get_stylesheet_directory', 10 ); |
554 | 554 | bp_register_template_stack( 'get_template_directory', 12 ); |
555 | 555 | bp_register_template_stack( 'bp_get_theme_compat_dir', 14 ); |
| 556 | bp_register_template_stack( 'get_stylesheet_directory_uri', 10, 'uri' ); |
| 557 | bp_register_template_stack( 'get_template_directory_uri', 12, 'uri' ); |
| 558 | bp_register_template_stack( 'bp_get_theme_compat_url', 14, 'uri' ); |
556 | 559 | } |
557 | 560 | |
558 | 561 | /** |
diff --git bp-templates/bp-legacy/buddypress-functions.php bp-templates/bp-legacy/buddypress-functions.php
index af2a5cd..564c422 100644
|
|
class BP_Legacy extends BP_Theme_Compat { |
197 | 197 | // LTR or RTL |
198 | 198 | $file = is_rtl() ? 'css/buddypress-rtl.css' : 'css/buddypress.css'; |
199 | 199 | |
| 200 | $located = false; |
| 201 | $template_locations = bp_get_template_stack( 'uri' ); |
| 202 | var_dump( $template_locations ); |
| 203 | |
| 204 | foreach ( (array) $template_locations as $template_location ) { |
| 205 | if ( empty( $template_location ) ) { |
| 206 | continue; |
| 207 | } |
| 208 | |
| 209 | if ( file_exists( trailingslashit( $template_location ) . $file ) ) { |
| 210 | $located = trailingslashit( $template_location ) . $file; |
| 211 | break; |
| 212 | } |
| 213 | } |
200 | 214 | // Check child theme |
201 | 215 | if ( file_exists( trailingslashit( get_stylesheet_directory() ) . $file ) ) { |
202 | 216 | $location = trailingslashit( get_stylesheet_directory_uri() ); |