diff --git a/SourceGithub/SourceGithub.php b/SourceGithub/SourceGithub.php index 0223e36..652c9c4 100644 --- a/SourceGithub/SourceGithub.php +++ b/SourceGithub/SourceGithub.php @@ -101,8 +101,71 @@ } function url_diff( $p_event, $p_repo, $p_changeset, $p_file ) { + if ( 'github' != $p_repo->type ) { + return $p_repo; + } + + $t_username = $p_repo->info['hub_username']; + $t_reponame = $p_repo->info['hub_reponame']; + $t_ref = "$t_changeset->revision"; + $t_filename = $t_file->filename; + + return "http://github.com/$t_username/$t_reponame/commit/$t_ref"; + } + + function update_repo_form( $p_event, $p_repo ) { + if ( 'github' != $p_repo->type ) { + return; + } + + if ( isset( $t_repo->info['hub_username'] ) ) { + $t_username = $t_repo->info['hub_username']; + } + if ( isset( $t_repo->info['hub_reponame'] ) ) { + $t_username = $t_repo->info['hub_reponame']; + } +?> +
'; + + $t_uri_base = 'http://github.com/api/v1/json/' . + urlencode( $p_repo->info['hub_username'] ) . '/' . + urlencode( $p_repo->info['hub_reponame'] ) . '/'; + $t_json = file_get_contents( $t_uri_base . 'commits/master' ); + + $t_data = json_decode( $t_json, true ); + var_dump( $t_data ); + die(); + } }