dousongxuan7507
dousongxuan7507
2014-03-12 04:17
浏览 42
已采纳

映射PHP方法和函数的顺序 - 动态

I would like to visualize where data is passed, from its start point to its end point. Is there a way to use php log to create list of where data has been passed?

If NO - Maybe you can offer me some advice.

The code below is for an activity feed. Data posted is passed into one function - placed into an array, and passed to the function below. From there the data is transferred to this class and I would like to understand what happens to it from there.

function bp_activity_add( $args = '' ) {

$defaults = array(
    'id'                => false, // Pass an existing activity ID to update an existing entry.

    'action'            => '',    // The activity action - e.g. "Jon Doe posted an update"
    'content'           => '',    // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"

    'component'         => false, // The name/ID of the component e.g. groups, profile, mycomponent
    'type'              => false, // The activity type e.g. activity_update, profile_updated
    'primary_link'      => '',    // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)

    'user_id'           => bp_loggedin_user_id(), // Optional: The user to record the activity for, can be false if this activity is not for a user.
    'item_id'           => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
    'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
    'recorded_time'     => bp_core_current_time(), // The GMT time that this activity was recorded
    'hide_sitewide'     => false, // Should this be hidden on the sitewide activity stream?
    'is_spam'           => false, // Is this activity item to be marked as spam?
);
$params = wp_parse_args( $args, $defaults );
extract( $params, EXTR_SKIP );

// Make sure we are backwards compatible
if ( empty( $component ) && !empty( $component_name ) )
    $component = $component_name;

if ( empty( $type ) && !empty( $component_action ) )
    $type = $component_action;

// Setup activity to be added
$activity                    = new BP_Activity_Activity( $id );
$activity->user_id           = $user_id;
$activity->component         = $component;
$activity->type              = $type;
$activity->action            = $action;
$activity->content           = $content;
$activity->primary_link      = $primary_link;
$activity->item_id           = $item_id;
$activity->secondary_item_id = $secondary_item_id;
$activity->date_recorded     = $recorded_time;
$activity->hide_sitewide     = $hide_sitewide;
$activity->is_spam           = $is_spam;

if ( !$activity->save() )
    return false;

// If this is an activity comment, rebuild the tree
if ( 'activity_comment' == $activity->type )
    BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id );

wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
do_action( 'bp_activity_add', $params );

return $activity->id;
}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐