Changeset 3830
- Timestamp:
- 04/02/2012 06:15:44 PM (14 years ago)
- Location:
- branches/plugin
- Files:
-
- 10 edited
-
bbp-admin/bbp-admin.php (modified) (2 diffs)
-
bbp-admin/bbp-settings.php (modified) (1 diff)
-
bbp-includes/bbp-common-functions.php (modified) (1 diff)
-
bbp-includes/bbp-core-actions.php (modified) (25 diffs)
-
bbp-includes/bbp-core-options.php (modified) (21 diffs)
-
bbp-includes/bbp-extend-akismet.php (modified) (1 diff)
-
bbp-includes/bbp-theme-compatibility.php (modified) (16 diffs)
-
bbp-theme-compat/bbpress-functions.php (modified) (4 diffs)
-
bbp-themes/bbp-twentyten/bbpress-functions.php (modified) (3 diffs)
-
bbpress.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-admin.php
r3816 r3830 192 192 __( 'Converter', 'bbpress' ), 193 193 'manage_options', 194 'bbp ress',194 'bbp-converter', 195 195 'bbp_converter_settings' 196 196 ); … … 289 289 add_settings_field( '_bbp_use_autoembed', __( 'Auto-embed Links', 'bbpress' ), 'bbp_admin_setting_callback_use_autoembed', 'bbpress', 'bbp_main' ); 290 290 register_setting ( 'bbpress', '_bbp_use_autoembed', 'intval' ); 291 292 /** Theme Packages ****************************************************/ 293 294 // Add the per page section 295 add_settings_section( 'bbp_theme_compat', __( 'Theme Packages', 'bbpress' ), 'bbp_admin_setting_callback_subtheme_section', 'bbpress' ); 296 297 // Replies per page setting 298 add_settings_field( '_bbp_theme_package_id', __( 'Current Package', 'bbpress' ), 'bbp_admin_setting_callback_subtheme_id', 'bbpress', 'bbp_theme_compat' ); 299 register_setting ( 'bbpress', '_bbp_theme_package_id', '' ); 291 300 292 301 /** Per Page Section **************************************************/ -
branches/plugin/bbp-admin/bbp-settings.php
r3816 r3830 152 152 153 153 <?php 154 } 155 156 /** 157 * Main subtheme section 158 * 159 * @since bbPress (r2786) 160 */ 161 function bbp_admin_setting_callback_subtheme_section() { 162 ?> 163 164 <p><?php _e( 'How your forum content is displayed within your existing theme.', 'bbpress' ); ?></p> 165 166 <?php 167 } 168 169 /** 170 * Use the WordPress editor setting field 171 * 172 * @since bbPress (r3586) 173 * 174 * @uses checked() To display the checked attribute 175 */ 176 function bbp_admin_setting_callback_subtheme_id() { 177 178 // Declare locale variable 179 $theme_options = ''; 180 $current_package = bbp_get_theme_package_id( 'default' ); 181 182 // Note: This should never be empty. /bbp-includes/bbp-theme-compat/ is the 183 // canonical backup if no other packages exist. If there's an error here, 184 // something else is wrong. 185 // 186 // @see bbPress::register_theme_packages() 187 foreach ( (array) bbpress()->theme_compat->packages as $id => $theme ) { 188 $theme_options .= '<option value="' . esc_attr( $id ) . '"' . selected( $theme->id, $current_package, false ) . '>' . sprintf( __( '%1$s - %2$s', 'bbpress' ), esc_html( $theme->name ), esc_html( str_replace( WP_CONTENT_DIR, '', $theme->dir ) ) ) . '</option>'; 189 } 190 191 if ( !empty( $theme_options ) ) : ?> 192 193 <select name="_bbp_theme_package_id" id="_bbp_theme_package_id" /><?php echo $theme_options ?></select> 194 <label for="_bbp_theme_package_id"><?php _e( 'will serve all bbPress templates', 'bbpress' ); ?></label> 195 196 <?php else : ?> 197 198 <select name="_bbp_theme_package_id" id="_bbp_theme_package_id" /><?php echo $theme_options ?></select> 199 <label for="_bbp_theme_package_id"><?php _e( 'Use the fancy WordPress editor to create and edit topics and replies', 'bbpress' ); ?></label> 200 201 <?php endif; 154 202 } 155 203 -
branches/plugin/bbp-includes/bbp-common-functions.php
r3806 r3830 1520 1520 case bbp_get_forum_post_type() : 1521 1521 1522 // De clare local variable(s)1522 // Define local variable(s) 1523 1523 $meta_query = array(); 1524 1524 -
branches/plugin/bbp-includes/bbp-core-actions.php
r3784 r3830 66 66 add_action( 'bbp_loaded', 'bbp_setup_globals', 8 ); 67 67 add_action( 'bbp_loaded', 'bbp_register_theme_directory', 10 ); 68 add_action( 'bbp_loaded', 'bbp_register_theme_packages', 12 ); 68 69 69 70 /** … … 251 252 * 252 253 * @since bbPress (r3395) 253 *254 254 * @return If BuddyPress is not active 255 255 */ … … 291 291 * 292 292 * @since bbPress (r2509) 293 *294 293 * @uses register_uninstall_hook() To register our own uninstall hook 295 294 * @uses do_action() Calls 'bbp_activation' hook … … 303 302 * 304 303 * @since bbPress (r2509) 305 *306 304 * @uses do_action() Calls 'bbp_deactivation' hook 307 305 */ … … 314 312 * 315 313 * @since bbPress (r2509) 316 *317 314 * @uses do_action() Calls 'bbp_uninstall' hook 318 315 */ … … 327 324 * 328 325 * @since bbPress (r2599) 329 *330 326 * @uses do_action() Calls 'bbp_loaded' 331 327 */ … … 338 334 * 339 335 * @since bbPress (r2599) 340 *341 336 * @uses do_action() Calls 'bbp_constants' 342 337 */ … … 349 344 * 350 345 * @since bbPress (r2599) 351 *352 346 * @uses do_action() Calls 'bbp_boot_strap_globals' 353 347 */ … … 360 354 * 361 355 * @since bbPress (r2599) 362 *363 356 * @uses do_action() Calls 'bbp_includes' 364 357 */ … … 371 364 * 372 365 * @since bbPress (r2599) 373 *374 366 * @uses do_action() Calls 'bbp_setup_globals' 375 367 */ … … 382 374 * 383 375 * @since bbPress (r2599) 384 *385 376 * @uses do_action() Calls 'bbp_init' 386 377 */ … … 393 384 * 394 385 * @since bbPress (r3389) 395 *396 386 * @uses do_action() Calls 'bbp_widgets_init' 397 387 */ … … 404 394 * 405 395 * @since bbPress (r2695) 406 *407 396 * @uses do_action() Calls 'bbp_setup_current_user' 408 397 */ … … 417 406 * 418 407 * @since bbPress (r2599) 419 *420 408 * @uses do_action() Calls 'bbp_load_textdomain' 421 409 */ … … 428 416 * 429 417 * @since bbPress (r2507) 430 *431 418 * @uses do_action() Calls 'bbp_register_theme_directory' 432 419 */ … … 439 426 * 440 427 * @since bbPress (r2464) 441 *442 428 * @uses do_action() Calls 'bbp_register_post_type' 443 429 */ … … 450 436 * 451 437 * @since bbPress (r2727) 452 *453 438 * @uses do_action() Calls 'bbp_register_post_statuses' 454 439 */ … … 461 446 * 462 447 * @since bbPress (r2464) 463 *464 448 * @uses do_action() Calls 'bbp_register_taxonomies' 465 449 */ … … 472 456 * 473 457 * @since bbPress (r2789) 474 *475 458 * @uses do_action() Calls 'bbp_register_views' 476 459 */ … … 483 466 * 484 467 * @since bbPress (r3373) 485 *486 468 * @uses do_action() Calls 'bbp_enqueue_scripts' 487 469 */ … … 494 476 * 495 477 * @since bbPress (r2753) 496 *497 478 * @uses do_action() Calls 'bbp_add_rewrite_tags' 498 479 */ … … 507 488 * 508 489 * @since bbPress (r2618) 509 *510 490 * @uses do_action() Calls 'bbp_ready' 511 491 */ … … 521 501 * 522 502 * @since bbPress (r3605) 523 *524 503 * @uses do_action() 525 504 */ … … 533 512 * The main action used for executing code before the theme has been setup 534 513 * 514 * @since bbPress (r3829) 515 * @uses do_action() 516 */ 517 function bbp_register_theme_packages() { 518 do_action( 'bbp_register_theme_packages' ); 519 } 520 521 /** 522 * The main action used for executing code before the theme has been setup 523 * 535 524 * @since bbPress (r3732) 536 *537 525 * @uses do_action() 538 526 */ … … 545 533 * 546 534 * @since bbPress (r3732) 547 *548 535 * @uses do_action() 549 536 */ -
branches/plugin/bbp-includes/bbp-core-options.php
r3792 r3830 15 15 * 16 16 * @since bbPress (r3421) 17 *18 17 * @return array Filtered option names and values 19 18 */ … … 53 52 '_bbp_use_autoembed' => false, 54 53 54 // The ID for the current theme package 55 '_bbp_theme_package_id' => 'default', 56 55 57 /** Per Page **********************************************************/ 56 58 … … 159 161 * This is non-destructive, so existing settings will not be overridden. 160 162 * 163 * @since bbPress (r3421) 161 164 * @uses bbp_get_default_options() To get default options 162 165 * @uses add_option() Adds default options … … 175 178 do_action( 'bbp_add_options' ); 176 179 } 180 177 181 /** 178 182 * Delete default options … … 181 185 * This is destructive, so existing settings will be destroyed. 182 186 * 187 * @since bbPress (r3421) 183 188 * @uses bbp_get_default_options() To get default options 184 189 * @uses delete_option() Removes default options … … 203 208 * 204 209 * @since bbPress (r3451) 205 *206 210 * @uses bbp_get_default_options() To get default options 207 211 * @uses add_filter() To add filters to 'pre_option_{$key}' … … 226 230 * 227 231 * @since bbPress (r3451) 228 *229 232 * @param bool $value Optional. Default value false 230 233 * @return mixed false if not overloaded, mixed if set … … 253 256 * 254 257 * @since bbPress (r2658) 255 *256 258 * @param $default bool Optional.Default value true 257 *258 259 * @uses get_option() To get the favorites option 259 260 * @return bool Is favorites enabled or not … … 267 268 * 268 269 * @since bbPress (r2658) 269 *270 270 * @param $default bool Optional.Default value true 271 *272 271 * @uses get_option() To get the subscriptions option 273 272 * @return bool Is subscription enabled or not … … 281 280 * 282 281 * @since bbPress (r3412) 283 *284 282 * @param $default bool Optional. Default value true 285 *286 283 * @uses get_option() To get the allow revisions 287 284 * @return bool Are revisions allowed? … … 295 292 * 296 293 * @since bbPress (r2659) 297 *298 294 * @param $default bool Optional. Default value 299 *300 295 * @uses get_option() To get the allow anonymous option 301 296 * @return bool Is anonymous posting allowed? … … 309 304 * 310 305 * @since bbPress (r3378) 311 *312 306 * @param $default bool Optional. Default value false 313 *314 307 * @uses get_option() To get the global access option 315 308 * @return bool Is global access allowed? … … 323 316 * 324 317 * @since bbPress (r3386) 325 *326 318 * @param $default bool Optional. Default value true 327 *328 319 * @uses get_option() To get the WP editor option 329 320 * @return bool Use WP editor? … … 337 328 * 338 329 * @since bbPress (r3752) 339 *340 330 * @param $default bool Optional. Default value true 341 *342 331 * @uses get_option() To get the oEmbed option 343 332 * @return bool Use oEmbed? … … 348 337 349 338 /** 339 * Get the current theme package ID 340 * 341 * @since bbPress (r3829) 342 * @param $default string Optional. Default value 'default' 343 * @uses get_option() To get the subtheme option 344 * @return string ID of the subtheme 345 */ 346 function bbp_get_theme_package_id( $default = 'default' ) { 347 return apply_filters( 'bbp_get_theme_package_id', get_option( '_bbp_theme_package_id', $default ) ); 348 } 349 350 /** 350 351 * Output the maximum length of a title 351 352 * 352 353 * @since bbPress (r3246) 353 *354 354 * @param $default bool Optional. Default value 80 355 355 */ … … 361 361 * 362 362 * @since bbPress (r3246) 363 *364 363 * @param $default bool Optional. Default value 80 365 *366 364 * @uses get_option() To get the maximum title length 367 365 * @return int Is anonymous posting allowed? … … 375 373 * 376 374 * @since bbPress (r3575) 377 *378 375 * @param $default bool Optional. Default value 379 376 */ … … 385 382 * 386 383 * @since bbPress (r3575) 387 *388 384 * @param $default bool Optional. Default value 0 389 *390 385 * @uses get_option() To get the maximum title length 391 386 * @return int Is anonymous posting allowed? … … 399 394 * 400 395 * @since bbPress (r3575) 401 *402 396 * @param $default bool Optional. Default value true 403 *404 397 * @uses get_option() To get the group forums option 405 398 * @return bool Is group forums enabled or not … … 413 406 * 414 407 * @since bbPress (r3575) 415 *416 408 * @param $default bool Optional. Default value true 417 *418 409 * @uses get_option() To get the Akismet option 419 410 * @return bool Is Akismet enabled or not … … 536 527 * 537 528 * @since bbPress (r3790) 538 *539 529 * @param $default string Optional. Default empty string 540 *541 530 * @uses get_option() To get the old bb-config.php location 542 531 * @return string The location of the bb-config.php file, if any -
branches/plugin/bbp-includes/bbp-extend-akismet.php
r3758 r3830 91 91 public function check_post( $post_data ) { 92 92 93 // De clare local variables93 // Define local variables 94 94 $user_data = array(); 95 95 $post_permalink = ''; -
branches/plugin/bbp-includes/bbp-theme-compatibility.php
r3783 r3830 35 35 */ 36 36 class BBP_Theme_Compat { 37 38 /** 39 * @var string ID of the theme (should be unique) 40 */ 41 public $id = ''; 37 42 38 43 /** … … 63 68 * 64 69 * @since bbPress (r3311) 65 *66 70 * @param BBP_Theme_Compat $theme 67 71 */ 68 72 function bbp_setup_theme_compat( $theme = '' ) { 69 bbpress()->theme_compat->theme = $theme; 73 $bbp = bbpress(); 74 75 // Make sure theme package is available, set to default if not 76 if ( ! isset( $bbp->theme_compat->packages[$theme] ) || ! is_a( $bbp->theme_compat->packages[$theme], 'BBP_Theme_Compat' ) ) { 77 $theme = 'default'; 78 } 79 80 // Set the active theme compat theme 81 $bbp->theme_compat->theme = $bbp->theme_compat->packages[$theme]; 70 82 } 71 83 … … 77 89 * 78 90 * @since bbPress (r3506) 79 * 91 * @uses apply_filters() 92 * @return string 93 */ 94 function bbp_get_theme_compat_id() { 95 return apply_filters( 'bbp_get_theme_compat_id', bbpress()->theme_compat->theme->id ); 96 } 97 98 /** 99 * Gets the name of the bbPress compatable theme used, in the event the 100 * currently active WordPress theme does not explicitly support bbPress. 101 * This can be filtered or set manually. Tricky theme authors can override the 102 * default and include their own bbPress compatability layers for their themes. 103 * 104 * @since bbPress (r3506) 80 105 * @uses apply_filters() 81 106 * @return string … … 92 117 * 93 118 * @since bbPress (r3506) 94 *95 119 * @uses apply_filters() 96 120 * @return string … … 107 131 * 108 132 * @since bbPress (r3032) 109 *110 133 * @uses apply_filters() 111 134 * @return string … … 122 145 * 123 146 * @since bbPress (r3032) 124 *125 147 * @uses apply_filters() 126 148 * @return string … … 134 156 * 135 157 * @since bbPress (r3265) 136 *137 158 * @return bool 138 159 */ … … 150 171 * 151 172 * @since bbPress (r3265) 152 *153 173 * @param bool $set 154 *155 174 * @return bool 156 175 */ … … 190 209 191 210 /** 211 * Register a new bbPress theme package to the active theme packages array 212 * 213 * @since bbPress (r3829) 214 * @param array $theme 215 */ 216 function bbp_register_theme_package( $theme = '', $override = true ) { 217 218 // Bail if no name or object passed is not a theme compat theme 219 if ( ! is_a( $theme, 'BBP_Theme_Compat' ) ) 220 return; 221 222 // Load up bbPress 223 $bbp = bbpress(); 224 225 // Only override if the flag is set and notpreviously registered 226 if ( ! empty( $bbp->theme_compat->packages[$theme->id] ) || ( true === $override ) ) { 227 $bbp->theme_compat->packages[$theme->id] = $theme; 228 } 229 } 230 231 /** 192 232 * This fun little function fills up some WordPress globals with dummy data to 193 233 * stop your average page template from complaining about it missing. 194 234 * 195 235 * @since bbPress (r3108) 196 *197 236 * @global WP_Query $wp_query 198 237 * @global object $post … … 247 286 248 287 // Setup the dummy post object 288 $wp_query->post = new stdClass; 249 289 $wp_query->post->ID = $dummy['ID']; 250 290 $wp_query->post->post_title = $dummy['post_title']; … … 280 320 * 281 321 * @since bbPress (r3032) 282 *283 322 * @param string $template 284 *285 323 * @uses bbp_is_single_user() To check if page is single user 286 324 * @uses bbp_get_single_user_template() To get user template … … 498 536 * 499 537 * @since bbPress (r3034) 500 *501 538 * @param string $content 502 539 * @return type … … 749 786 * 750 787 * @since bbPress (r2628) 751 *752 788 * @param string $redirect_url Redirect url 753 789 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks … … 807 843 * 808 844 * @since bbPress (r3251) 809 *810 845 * @global WP_filter $wp_filter 811 846 * @global array $merged_filters 812 *813 847 * @param string $tag 814 848 * @param int $priority 815 *816 849 * @return bool 817 850 */ … … 862 895 * 863 896 * @since bbPress (r3251) 864 *865 897 * @global WP_filter $wp_filter 866 898 * @global array $merged_filters 867 *868 899 * @param string $tag 869 900 * @param int $priority 870 *871 901 * @return bool 872 902 */ … … 916 946 * 917 947 * @since bbPress (r3589) 918 *919 948 * @param bool $open True if open, false if closed 920 949 * @param int $post_id ID of the post to check -
branches/plugin/bbp-theme-compat/bbpress-functions.php
r3782 r3830 15 15 16 16 if ( !class_exists( 'BBP_Default' ) ) : 17 18 /**19 * Uncomment the line below if this is for a custom theme.20 */21 //add_theme_support( 'bbpress' );22 17 23 18 /** … … 72 67 // Use the default theme compat if current theme has not added support 73 68 if ( !current_theme_supports( 'bbpress' ) ) { 69 $this->id = bbp_get_theme_compat_id(); 74 70 $this->name = bbp_get_theme_compat_name(); 75 71 $this->version = bbp_get_theme_compat_version(); … … 79 75 // Theme supports bbPress, so set some smart defaults 80 76 } else { 81 $this->name = sprintf( __( '%s (bbPress)', 'bbpress' ), get_current_theme() ) ; 77 $theme = wp_get_theme(); 78 $this->id = $theme->stylesheet; 79 $this->name = sprintf( __( '%s (bbPress)', 'bbpress' ), $theme->name ) ; 82 80 $this->version = bbp_get_version(); 83 81 $this->dir = trailingslashit( get_stylesheet_directory() ); 84 82 $this->url = trailingslashit( get_stylesheet_directory_uri() ); 85 83 } 84 85 // Conditionally add theme support if needed 86 if ( in_array( $this->id, array( get_template(), get_stylesheet() ) ) ) { 87 add_theme_support( 'bbpress' ); 88 } 86 89 } 87 90 … … 97 100 private function setup_actions() { 98 101 99 // Enqueue theme CSS 100 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); 101 102 // Enqueue theme JS 103 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 104 105 // Enqueue theme script localization 106 add_filter( 'bbp_enqueue_scripts', array( $this, 'localize_topic_script' ) ); 107 108 // Output some extra JS in the <head> 109 add_action( 'bbp_head', array( $this, 'head_scripts' ) ); 110 111 // Handles the ajax favorite/unfavorite 112 add_action( 'wp_ajax_dim-favorite', array( $this, 'ajax_favorite' ) ); 113 114 // Handles the ajax subscribe/unsubscribe 115 add_action( 'wp_ajax_dim-subscription', array( $this, 'ajax_subscription' ) ); 102 /** Scripts ***********************************************************/ 103 104 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); // Enqueue theme CSS 105 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue theme JS 106 add_filter( 'bbp_enqueue_scripts', array( $this, 'localize_topic_script' ) ); // Enqueue theme script localization 107 add_action( 'bbp_head', array( $this, 'head_scripts' ) ); // Output some extra JS in the <head> 108 add_action( 'wp_ajax_dim-favorite', array( $this, 'ajax_favorite' ) ); // Handles the ajax favorite/unfavorite 109 add_action( 'wp_ajax_dim-subscription', array( $this, 'ajax_subscription' ) ); // Handles the ajax subscribe/unsubscribe 116 110 117 111 /** Template Wrappers *************************************************/ 118 112 119 // Top wrapper HTML 120 add_action( 'bbp_before_main_content', array( $this, 'before_main_content' ) ); 121 122 // Bottom wrapper HTML 123 add_action( 'bbp_after_main_content', array( $this, 'after_main_content' ) ); 113 add_action( 'bbp_before_main_content', array( $this, 'before_main_content' ) ); // Top wrapper HTML 114 add_action( 'bbp_after_main_content', array( $this, 'after_main_content' ) ); // Bottom wrapper HTML 124 115 125 116 /** Override **********************************************************/ -
branches/plugin/bbp-themes/bbp-twentyten/bbpress-functions.php
r3821 r3830 15 15 16 16 if ( !class_exists( 'BBP_Twenty_Ten' ) ) : 17 18 // Theme supports bbPress19 add_theme_support( 'bbpress' );20 17 21 18 /** … … 59 56 */ 60 57 private function setup_globals() { 58 $bbp = bbpress(); 59 $this->id = 'bbp-twentyten'; 61 60 $this->name = __( 'Twenty Ten (bbPress)', 'bbpress' ) ; 62 61 $this->version = bbp_get_version(); 63 $this->dir = trailingslashit( get_stylesheet_directory() ); 64 $this->url = trailingslashit( get_stylesheet_directory_uri() ); 62 $this->dir = trailingslashit( $bbp->themes_dir . 'bbp-twentyten' ); 63 $this->url = trailingslashit( $bbp->themes_url . 'bbp-twentyten' ); 64 65 // Conditionally add theme support if needed 66 if ( in_array( $this->id, array( get_template(), get_stylesheet() ) ) ) { 67 add_theme_support( 'bbpress' ); 68 } 65 69 } 66 70 … … 74 78 */ 75 79 private function setup_actions() { 76 77 // Enqueue theme CSS 78 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); 79 80 // Enqueue theme JS 81 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 82 83 // Enqueue theme script localization 84 add_filter( 'bbp_enqueue_scripts', array( $this, 'localize_topic_script' ) ); 85 86 // Output some extra JS in the <head> 87 add_action( 'bbp_head', array( $this, 'head_scripts' ) ); 88 89 // Handles the ajax favorite/unfavorite 90 add_action( 'wp_ajax_dim-favorite', array( $this, 'ajax_favorite' ) ); 91 92 // Handles the ajax subscribe/unsubscribe 93 add_action( 'wp_ajax_dim-subscription', array( $this, 'ajax_subscription' ) ); 80 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); // Enqueue theme CSS 81 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue theme JS 82 add_filter( 'bbp_enqueue_scripts', array( $this, 'localize_topic_script' ) ); // Enqueue theme script localization 83 add_action( 'bbp_head', array( $this, 'head_scripts' ) ); // Output some extra JS in the <head> 84 add_action( 'wp_ajax_dim-favorite', array( $this, 'ajax_favorite' ) ); // Handles the ajax favorite/unfavorite 85 add_action( 'wp_ajax_dim-subscription', array( $this, 'ajax_subscription' ) ); // Handles the ajax subscribe/unsubscribe 94 86 } 95 87 -
branches/plugin/bbpress.php
r3827 r3830 250 250 * @var string Theme to use for theme compatibility 251 251 */ 252 public $theme_compat = '';252 public $theme_compat; 253 253 254 254 /** Extensions ************************************************************/ … … 349 349 350 350 // Themes 351 $this->themes_dir = $this->plugin_dir . 'bbp-themes';352 $this->themes_url = $this->plugin_url . 'bbp-themes';351 $this->themes_dir = trailingslashit( $this->plugin_dir . 'bbp-themes' ); 352 $this->themes_url = trailingslashit( $this->plugin_url . 'bbp-themes' ); 353 353 354 354 // Languages 355 $this->lang_dir = $this->plugin_dir . 'bbp-languages';355 $this->lang_dir = trailingslashit( $this->plugin_dir . 'bbp-languages' ); 356 356 357 357 /** Identifiers *******************************************************/ … … 395 395 $this->tab_index = apply_filters( 'bbp_default_tab_index', 100 ); 396 396 397 /** Theme Compat ******************************************************/ 398 399 // Base theme compatibility class 400 $this->theme_compat = new stdClass(); 401 397 402 /** Cache *************************************************************/ 398 403 … … 493 498 'register_views', // Register the views (no-replies) 494 499 'register_theme_directory', // Register the theme directory (bbp-themes) 500 'register_theme_packages', // Register bundled theme packages (bbp-theme-compat/bbp-themes) 495 501 'load_textdomain', // Load textdomain (bbpress) 496 502 'add_rewrite_tags', // Add rewrite tags (view|user|edit) … … 509 515 510 516 /** 517 * Register bundled theme packages 518 * 519 * @since bbPress (r3829) 520 */ 521 public function register_theme_packages() { 522 523 /** Default Theme *****************************************************/ 524 525 $theme = new BBP_Theme_Compat(); 526 $theme->id = 'default'; 527 $theme->name = __( 'bbPress Default', 'bbpress' ); 528 $theme->version = bbp_get_version(); 529 $theme->dir = trailingslashit( $this->plugin_dir . 'bbp-theme-compat' ); 530 $theme->url = trailingslashit( $this->plugin_url . 'bbp-theme-compat' ); 531 532 bbp_register_theme_package( $theme ); 533 534 /** Default Theme *****************************************************/ 535 536 $theme = new BBP_Theme_Compat(); 537 $theme->id = 'bbp-twentyten'; 538 $theme->name = __( 'Twenty Ten (bbPress)', 'bbpress' ) ; 539 $theme->version = bbp_get_version(); 540 $theme->dir = trailingslashit( $this->themes_dir . 'bbp-twentyten' ); 541 $theme->url = trailingslashit( $this->themes_url . 'bbp-twentyten' ); 542 543 bbp_register_theme_package( $theme ); 544 } 545 546 /** 511 547 * Setup the default bbPress theme compatability location. 512 548 * … … 515 551 public function setup_theme() { 516 552 517 // Bail early if theme_compat was set already by a plugin518 if ( ! empty( $this->theme_compat) )553 // Bail if something already has this under control 554 if ( ! empty( $this->theme_compat->theme ) ) 519 555 return; 520 556 521 // Set the defaults 522 $theme = new BBP_Theme_Compat(); 523 $theme->name = 'bbPress (Default)'; 524 $theme->version = bbp_get_version(); 525 $theme->dir = trailingslashit( $this->plugin_dir . 'bbp-theme-compat' ); 526 $theme->url = trailingslashit( $this->plugin_url . 'bbp-theme-compat' ); 527 528 bbp_setup_theme_compat( $theme ); 557 // Setup the theme package to use for compatibility 558 bbp_setup_theme_compat( bbp_get_theme_package_id() ); 529 559 } 530 560 … … 546 576 */ 547 577 public function load_textdomain() { 548 549 // Default locale 550 $locale = get_locale(); 551 552 // Traditional WordPress plugin locale filter 553 $locale = apply_filters( 'plugin_locale', $locale, 'bbpress' ); 554 555 // bbPress specific locale filter 556 $locale = apply_filters( 'bbpress_locale', $locale ); 557 558 // Get mo file name 559 $mofile = sprintf( 'bbpress-%s.mo', $locale ); 578 $locale = get_locale(); // Default locale 579 $locale = apply_filters( 'plugin_locale', $locale, 'bbpress' ); // Traditional WordPress plugin locale filter 580 $locale = apply_filters( 'bbpress_locale', $locale ); // bbPress specific locale filter 581 $mofile = sprintf( 'bbpress-%s.mo', $locale ); // Get mo file name 560 582 561 583 // Setup paths to current locale file 562 $mofile_local = $this->lang_dir . '/' .$mofile;584 $mofile_local = $this->lang_dir . $mofile; 563 585 $mofile_global = WP_LANG_DIR . '/bbpress/' . $mofile; 564 586 565 587 // Look in local /wp-content/plugins/bbpress/bbp-languages/ folder 566 if ( file_exists( $mofile_local ) ) 588 if ( file_exists( $mofile_local ) ) { 567 589 return load_textdomain( 'bbpress', $mofile_local ); 568 590 569 591 // Look in global /wp-content/languages/bbpress folder 570 elseif ( file_exists( $mofile_global ) )592 } elseif ( file_exists( $mofile_global ) ) { 571 593 return load_textdomain( 'bbpress', $mofile_global ); 594 } 572 595 573 596 // Nothing found … … 908 931 909 932 // Topics with no replies 910 $no_replies = apply_filters( 'bbp_register_view_no_replies', array( 911 'meta_key' => '_bbp_reply_count', 912 'meta_value' => 1, 913 'meta_compare' => '<', 914 'orderby' => '' 933 bbp_register_view( 934 'no-replies', 935 __( 'Topics with no replies', 'bbpress' ), 936 apply_filters( 'bbp_register_view_no_replies', array( 937 'meta_key' => '_bbp_reply_count', 938 'meta_value' => 1, 939 'meta_compare' => '<', 940 'orderby' => '' 941 ) 915 942 ) ); 916 917 bbp_register_view( 'no-replies', __( 'Topics with no replies', 'bbpress' ), $no_replies );918 943 } 919 944
Note: See TracChangeset
for help on using the changeset viewer.