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

映射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条回答 默认 最新

  • dongyi3776 2014-03-12 04:26
    关注

    You can use Xdebug stack trace but isn't going to get you the path of the variable but where the script has gone to get to that point. http://xdebug.org/docs/stack_trace

    If you have Xdebug installed with a IDE like eclipse, you can walk through the script. http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料