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

时间:2014-03-12 04:17:19

标签: php buddypress

我希望可视化数据从起点到终点的传递位置。有没有办法使用php日志创建数据传递的列表?

如果不是 - 也许你可以给我一些建议。

以下代码适用于活动Feed。发布的数据传递给一个函数 - 放入一个数组,并传递给下面的函数。从那里数据传输到 this class ,我想了解从那里发生的事情。

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 个答案:

答案 0 :(得分:1)

您可以使用Xdebug堆栈跟踪,但不会让您获得变量的路径,但脚本已经到达那一点。 http://xdebug.org/docs/stack_trace

如果你安装了像eclipse这样的IDE的Xdebug,你可以浏览一下脚本。 http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/