Skip to content

Instantly share code, notes, and snippets.

@farinspace
Created November 17, 2011 07:53
Show Gist options
  • Save farinspace/1372637 to your computer and use it in GitHub Desktop.
Save farinspace/1372637 to your computer and use it in GitHub Desktop.
Generate a list of hooks and filters for bbpress 2.0.1
<?php
// place and run in ./plugins/bbpress/bbp-themes
$dirs = array( './bbp-twentyten', './bbp-twentyten/bbpress' );
$actions = array();
$filters = array();
foreach ( $dirs as $dir )
{
$handle = opendir( $dir );
if ( $handle )
{
while ( false !== ( $file = readdir( $handle ) ) )
{
$file = $dir . '/' . $file;
if ( ! is_dir( $file ) && ! preg_match( '/css$/', $file ) )
{
$file_contents = file_get_contents( $file );
preg_match_all( '/do_action ?\((.*)\)/iU', $file_contents, $matches );
if ( is_array( $matches[1] ) )
{
foreach ( $matches[1] as $match )
{
$action = trim( $match, '\'" ' );
if ( ! isset( $actions[$action] ) ) $actions[$action] = array();
array_push( $actions[$action], $file );
//array_push( $actions, array( 'action' => $action, 'file' => $file ) );
}
}
preg_match_all( '/apply_filters ?\((.*)\)/iU', $file_contents, $matches );
if ( is_array( $matches[1] ) )
{
foreach ( $matches[1] as $match )
{
$action = trim( $match, '\'" ' );
array_push( $filters, array( 'filter' => $action, 'file' => $file ) );
}
}
}
}
closedir( $handle );
}
}
echo count($actions) . " actions found\n\n";
print_r( $actions );
print_r( $filters );
110 actions found
Array
(
[bbp_template_notices] => Array
(
[0] => ./bbp-twentyten/archive-forum.php
[1] => ./bbp-twentyten/archive-topic.php
[2] => ./bbp-twentyten/page-create-topic.php
[3] => ./bbp-twentyten/page-forum-statistics.php
[4] => ./bbp-twentyten/page-front-forums.php
[5] => ./bbp-twentyten/page-front-topics.php
[6] => ./bbp-twentyten/page-topic-tags.php
[7] => ./bbp-twentyten/page-topics-no-replies.php
[8] => ./bbp-twentyten/page-user-login.php
[9] => ./bbp-twentyten/page-user-lost-pass.php
[10] => ./bbp-twentyten/page-user-register.php
[11] => ./bbp-twentyten/single-forum.php
[12] => ./bbp-twentyten/single-reply.php
[13] => ./bbp-twentyten/single-topic-merge.php
[14] => ./bbp-twentyten/single-topic-split.php
[15] => ./bbp-twentyten/single-topic.php
[16] => ./bbp-twentyten/single-view.php
[17] => ./bbp-twentyten/taxonomy-topic-tag-edit.php
[18] => ./bbp-twentyten/taxonomy-topic-tag.php
[19] => ./bbp-twentyten/bbpress/content-single-user-edit.php
[20] => ./bbp-twentyten/bbpress/content-single-user.php
[21] => ./bbp-twentyten/bbpress/form-reply.php
[22] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_before_statistics] => Array
(
[0] => ./bbp-twentyten/page-forum-statistics.php
)
[bbp_after_statistics] => Array
(
[0] => ./bbp-twentyten/page-forum-statistics.php
)
[bbp_before_popular_topics] => Array
(
[0] => ./bbp-twentyten/page-forum-statistics.php
)
[bbp_after_popular_topics] => Array
(
[0] => ./bbp-twentyten/page-forum-statistics.php
)
[bbp_template_before_topic_tag_edit] => Array
(
[0] => ./bbp-twentyten/taxonomy-topic-tag-edit.php
)
[bbp_template_after_topic_tag_edit] => Array
(
[0] => ./bbp-twentyten/taxonomy-topic-tag-edit.php
)
[bbp_template_before_topic_tag] => Array
(
[0] => ./bbp-twentyten/taxonomy-topic-tag.php
)
[bbp_template_after_topic_tag] => Array
(
[0] => ./bbp-twentyten/taxonomy-topic-tag.php
)
[bbp_template_before_forums_index] => Array
(
[0] => ./bbp-twentyten/bbpress/content-archive-forum.php
)
[bbp_template_after_forums_index] => Array
(
[0] => ./bbp-twentyten/bbpress/content-archive-forum.php
)
[bbp_template_before_topics_index] => Array
(
[0] => ./bbp-twentyten/bbpress/content-archive-topic.php
)
[bbp_template_after_topics_index] => Array
(
[0] => ./bbp-twentyten/bbpress/content-archive-topic.php
)
[bbp_template_before_single_topic] => Array
(
[0] => ./bbp-twentyten/bbpress/content-single-topic.php
)
[bbp_template_after_single_topic] => Array
(
[0] => ./bbp-twentyten/bbpress/content-single-topic.php
)
[bbp_theme_before_anonymous_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-anonymous.php
)
[bbp_theme_anonymous_form_extras_top] => Array
(
[0] => ./bbp-twentyten/bbpress/form-anonymous.php
)
[bbp_theme_anonymous_form_extras_bottom] => Array
(
[0] => ./bbp-twentyten/bbpress/form-anonymous.php
)
[bbp_theme_after_anonymous_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-anonymous.php
)
[bbp_theme_before_reply_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_reply_form_notices] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_reply_form_content] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_after_reply_form_content] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_reply_form_tags] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_after_reply_form_tags] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_reply_form_subscription] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_after_reply_form_subscription] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_reply_form_revisions] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_after_reply_form_revisions] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_reply_form_submit_wrapper] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_reply_form_submit_button] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_after_reply_form_submit_button] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_after_reply_form_submit_wrapper] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_after_reply_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-reply.php
)
[bbp_theme_before_topic_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_notices] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_title] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_title] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_content] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_content] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_tags] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_tags] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_forum] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_forum] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_type] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_type] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_subscriptions] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_subscriptions] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_revisions] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_revisions] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_submit_wrapper] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_before_topic_form_submit_button] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_submit_button] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form_submit_wrapper] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_theme_after_topic_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-topic.php
)
[bbp_user_edit_before] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_before_name] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_after_name] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_before_contact] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_after_contact] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_before_about] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_after_about] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_before_account] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_after_account] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[bbp_user_edit_after] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[login_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-login.php
)
[login_form', 'resetpass] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-lost-pass.php
)
[register_form] => Array
(
[0] => ./bbp-twentyten/bbpress/form-user-register.php
)
[bbp_template_before_forums_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-forums.php
)
[bbp_template_after_forums_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-forums.php
)
[bbp_template_before_replies_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-replies.php
)
[bbp_template_after_replies_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-replies.php
)
[bbp_theme_before_forum_title] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_after_forum_title] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_before_forum_sub_forums] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_after_forum_sub_forums] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_before_forum_description] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_after_forum_description] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_before_forum_freshness_link] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_after_forum_freshness_link] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_before_topic_author] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_after_topic_author] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-forum.php
)
[bbp_theme_before_reply_admin_links] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_after_reply_admin_links] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_before_reply_author_details] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_before_reply_author_admin_details] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_after_reply_author_admin_details] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_after_reply_author_details] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_after_reply_content] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_before_reply_content] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-reply.php
)
[bbp_theme_before_topic_title] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_title] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_before_topic_meta] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_before_topic_started_by] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_started_by] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_before_topic_started_in] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_started_in] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_meta] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_before_topic_freshness_link] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_freshness_link] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_before_topic_freshness_author] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_freshness_author] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_before_topic_favorites_action] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_favorites_action] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_before_topic_subscription_action] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_theme_after_topic_subscription_action] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-single-topic.php
)
[bbp_template_before_topics_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-topics.php
)
[bbp_template_after_topics_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/loop-topics.php
)
[bbp_template_before_pagination_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/pagination-replies.php
[1] => ./bbp-twentyten/bbpress/pagination-topics.php
)
[bbp_template_after_pagination_loop] => Array
(
[0] => ./bbp-twentyten/bbpress/pagination-replies.php
[1] => ./bbp-twentyten/bbpress/pagination-topics.php
)
)
Array
(
[0] => Array
(
[filter] =>
[file] => ./bbp-twentyten/functions.php
)
[1] => Array
(
[filter] => editable_slug', bbp_get_topic_tag_slug(
[file] => ./bbp-twentyten/bbpress/form-topic-tag.php
)
[2] => Array
(
[filter] => user_'.$name.'_label', $desc
[file] => ./bbp-twentyten/bbpress/form-user-edit.php
)
[3] => Array
(
[filter] => twentyten_author_bio_avatar_size', 60
[file] => ./bbp-twentyten/bbpress/user-details.php
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment