[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Sets up the default filters and actions for most 4 * of the bbPress hooks. 5 * 6 * If you need to remove a default hook, this file will 7 * give you the priority for which to use to remove the 8 * hook. 9 * 10 * Not all of the default hooks are found in this files 11 * 12 * @package bbPress 13 */ 14 15 // Strip, trim, kses, special chars for string saves 16 $filters = array( 'pre_term_name', 'bb_pre_forum_name', 'pre_topic_title' ); 17 foreach ( $filters as $filter ) { 18 add_filter( $filter, 'strip_tags' ); 19 add_filter( $filter, 'trim' ); 20 add_filter( $filter, 'bb_filter_kses' ); 21 add_filter( $filter, 'esc_html', 30 ); 22 } 23 24 // Kses only for textarea saves 25 $filters = array( 'pre_term_description', 'bb_pre_forum_desc' ); 26 foreach ( $filters as $filter ) { 27 add_filter( $filter, 'bb_filter_kses' ); 28 } 29 30 // Slugs 31 add_filter( 'pre_term_slug', 'bb_pre_term_slug' ); 32 add_filter( 'editable_slug', 'urldecode'); 33 34 // DB truncations 35 add_filter( 'pre_topic_title', 'bb_trim_for_db_150', 9999 ); 36 add_filter( 'bb_pre_forum_name', 'bb_trim_for_db_150', 9999 ); 37 add_filter( 'pre_term_name', 'bb_trim_for_db_55', 9999 ); 38 39 // Format Strings for Display 40 $filters = array( 'forum_name', 'topic_title', 'bb_title', 'bb_option_name' ); 41 foreach ( $filters as $filter ) { 42 add_filter( $filter, 'esc_html' ); 43 } 44 45 // Numbers 46 $filters = array( 'forum_topics', 'forum_posts', 'total_posts', 'total_users', 'total_topics' ); 47 foreach ( $filters as $filter ) { 48 add_filter( $filter, 'bb_number_format_i18n' ); 49 } 50 51 // Offset Times 52 $filters = array( 'topic_time', 'topic_start_time', 'bb_post_time' ); 53 foreach ( $filters as $filter ) { 54 add_filter( $filter, 'bb_offset_time', 10, 2 ); 55 } 56 57 add_filter('bb_topic_labels', 'bb_closed_label', 10); 58 add_filter('bb_topic_labels', 'bb_sticky_label', 20); 59 60 add_filter('pre_post', 'trim'); 61 add_filter('pre_post', 'bb_encode_bad'); 62 add_filter('pre_post', 'bb_code_trick'); 63 add_filter('pre_post', 'force_balance_tags'); 64 add_filter('pre_post', 'bb_filter_kses', 50); 65 add_filter('pre_post', 'bb_autop', 60); 66 67 add_filter('post_text', 'do_shortcode'); 68 69 function bb_contextualise_search_post_text() 70 { 71 if ( bb_is_search() ) { 72 add_filter( 'get_post_text', 'bb_post_text_context' ); 73 } 74 } 75 add_action( 'bb_init', 'bb_contextualise_search_post_text' ); 76 77 add_filter('post_text', 'make_clickable'); 78 79 add_filter('edit_text', 'bb_code_trick_reverse'); 80 add_filter('edit_text', 'wp_specialchars'); 81 add_filter('edit_text', 'trim', 15); 82 83 add_filter('pre_sanitize_with_dashes', 'bb_pre_sanitize_with_dashes_utf8', 10, 3 ); 84 85 add_filter('get_user_link', 'bb_fix_link'); 86 87 add_filter('sanitize_profile_info', 'esc_html'); 88 add_filter('sanitize_profile_admin', 'esc_html'); 89 90 add_filter( 'get_recent_user_replies_fields', 'bb_get_recent_user_replies_fields' ); 91 add_filter( 'get_recent_user_replies_group_by', 'bb_get_recent_user_replies_group_by' ); 92 93 add_filter('sort_tag_heat_map', 'bb_sort_tag_heat_map'); 94 95 // URLS 96 97 if ( !bb_get_option( 'mod_rewrite' ) ) { 98 add_filter( 'bb_stylesheet_uri', 'esc_attr', 1, 9999 ); 99 add_filter( 'forum_link', 'esc_attr', 1, 9999 ); 100 add_filter( 'bb_forum_posts_rss_link', 'esc_attr', 1, 9999 ); 101 add_filter( 'bb_forum_topics_rss_link', 'esc_attr', 1, 9999 ); 102 add_filter( 'bb_tag_link', 'esc_attr', 1, 9999 ); 103 add_filter( 'tag_rss_link', 'esc_attr', 1, 9999 ); 104 add_filter( 'topic_link', 'esc_attr', 1, 9999 ); 105 add_filter( 'topic_rss_link', 'esc_attr', 1, 9999 ); 106 add_filter( 'post_link', 'esc_attr', 1, 9999 ); 107 add_filter( 'post_anchor_link', 'esc_attr', 1, 9999 ); 108 add_filter( 'user_profile_link', 'esc_attr', 1, 9999 ); 109 add_filter( 'profile_tab_link', 'esc_attr', 1, 9999 ); 110 add_filter( 'favorites_link', 'esc_attr', 1, 9999 ); 111 add_filter( 'view_link', 'esc_attr', 1, 9999 ); 112 } 113 114 // Feed Stuff 115 116 function bb_filter_feed_content() 117 { 118 if ( bb_is_feed() ) { 119 add_filter( 'bb_title_rss', 'strip_tags' ); 120 add_filter( 'bb_title_rss', 'ent2ncr', 8 ); 121 add_filter( 'bb_title_rss', 'esc_html' ); 122 123 add_filter( 'bb_description_rss', 'strip_tags' ); 124 add_filter( 'bb_description_rss', 'ent2ncr', 8 ); 125 add_filter( 'bb_description_rss', 'esc_html' ); 126 127 add_filter( 'post_author', 'ent2ncr', 8 ); 128 add_filter( 'post_link', 'esc_html' ); 129 add_filter( 'post_text', 'ent2ncr', 8 ); 130 add_filter( 'post_text', 'bb_convert_chars' ); 131 } 132 } 133 add_action( 'bb_init', 'bb_filter_feed_content' ); 134 135 add_action( 'init_roles', 'bb_init_roles' ); 136 add_filter( 'map_meta_cap', 'bb_map_meta_cap', 1, 4 ); 137 138 // Actions 139 140 add_action( 'bb_head', 'bb_generator' ); 141 add_action('bb_head', 'bb_template_scripts'); 142 add_action('bb_head', 'wp_print_scripts'); 143 add_action('bb_head', 'wp_print_styles'); 144 add_action('bb_head', 'bb_rsd_link'); 145 add_action('bb_head', 'bb_pingback_link'); 146 if ( $bb_log->type === 'console' ) { 147 add_action('bb_head', array(&$bb_log, 'console_javascript')); 148 add_action('bb_admin_head', array(&$bb_log, 'console_javascript')); 149 } 150 add_action('bb_send_headers', 'bb_pingback_header'); 151 add_action('bb_admin_print_scripts', 'wp_print_scripts'); 152 153 add_action('bb_user_has_no_caps', 'bb_give_user_default_role'); 154 155 add_action('do_pingbacks', array('BB_Pingbacks', 'send_all'), 10, 1); 156 157 add_action( 'bb_init', 'bb_register_default_views' ); 158 159 add_action( 'set_current_user', 'bb_apply_wp_role_map_to_user' ); 160 161 add_filter( 'bb_pre_get_option_gmt_offset', 'wp_timezone_override_offset' ); 162 163 // Subscriptions 164 165 if ( bb_is_subscriptions_active() ) { 166 add_action( 'bb_new_post', 'bb_notify_subscribers' ); 167 add_action( 'bb_insert_post', 'bb_user_subscribe_checkbox_update' ); 168 add_action( 'topicmeta', 'bb_user_subscribe_link' ); 169 add_action( 'edit_form', 'bb_user_subscribe_checkbox' ); 170 add_action( 'post_form', 'bb_user_subscribe_checkbox' ); 171 } 172 173 add_action( 'bb_post-form.php', 'bb_anonymous_post_form' ); 174 175 unset( $filters, $filter );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Dec 7 01:01:35 2017 | Cross-referenced by PHPXref 0.7.1 |