1111
1212class SourceGitphpPlugin extends MantisSourcePlugin {
1313
14- const PLUGIN_VERSION = '1 .0.0 ' ;
15- const FRAMEWORK_VERSION_REQUIRED = '1.3.2 ' ;
14+ const PLUGIN_VERSION = '2 .0.0 ' ;
15+ const FRAMEWORK_VERSION_REQUIRED = '2.0.0 ' ;
1616
1717 public function register () {
1818 $ this ->name = plugin_lang_get ( 'title ' );
@@ -65,8 +65,8 @@ public function url_file( $p_repo, $p_changeset, $p_file ) {
6565 }
6666
6767 public function url_diff ( $ p_repo , $ p_changeset , $ p_file ) {
68- return $ this ->uri_base ( $ p_repo ) . 'a=blobdiff&f= ' . $ p_file ->filename .
69- '&h= ' . $ p_file ->revision . '&hb= ' . $ p_changeset ->revision . '&hp= ' . $ p_changeset ->parent ;
68+ return $ this ->uri_base ( $ p_repo ) . 'a=blobdiff&f= ' . $ p_file ->filename .
69+ '&h= ' . $ p_file ->revision . '&hb= ' . $ p_changeset ->revision . '&hp= ' . $ p_changeset ->parent ;
7070 }
7171
7272 public function update_repo_form ( $ p_repo ) {
@@ -263,7 +263,7 @@ private function import_commits( $p_repo, $p_uri_base, $p_commit_ids, $p_branch=
263263 private function commit_changeset ( $ p_repo , $ p_input , $ p_branch ='' ) {
264264
265265 $ t_input = str_replace ( array ("\r" , "\n" , '< ' , '> ' , ' ' ), array ('' , '' , '< ' , '> ' , ' ' ), $ p_input );
266-
266+
267267 # Extract sections of commit data and changed files
268268 $ t_input_p1 = strpos ( $ t_input , '<div class="title"> ' );
269269 $ t_input_p2 = strpos ( $ t_input , '<div class="list_head"> ' );
@@ -280,36 +280,36 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) {
280280 $ t_input_p1 = strpos ( $ t_input , '<tr class="light"> ' );
281281 if ( false === $ t_input_p1 ) {
282282 $ t_input_p1 = strpos ( $ t_input , '<tr class="dark"> ' );
283- }
283+ }
284284 }
285285
286286 $ t_input_p2 = strpos ( $ t_input , '<div class="page_footer"> ' );
287-
287+
288288 if ( false === $ t_input_p1 || false === $ t_input_p2 ) {
289289 echo 'file data failure. ' ;
290290 var_dump ( strlen ( $ t_input ), $ t_input_p1 , $ t_input_p2 );
291291 print_r ($ t_input );
292292 die ();
293293 }
294-
294+
295295 $ t_gitphp_files = substr ( $ t_input , $ t_input_p1 , $ t_input_p2 - $ t_input_p1 );
296-
297-
296+
297+
298298 # Get commit revsion and make sure it's not a dupe
299299 preg_match ( '#<td class="monospace">([a-f0-9]*)# ' , $ t_gitphp_data , $ t_matches );
300-
300+
301301 $ t_commit ['revision ' ] = $ t_matches [1 ];
302-
302+
303303 echo "processing $ t_commit [revision] ... \n" ;
304-
304+
305305 if ( !SourceChangeset::exists ( $ p_repo ->id , $ t_commit ['revision ' ] ) ) {
306-
306+
307307 # Parse for commit data
308308 # m modifier means "make . include newlines"
309309 # x modifier means "ignore whitespace"
310310 preg_match ( '#<td>author</td>.*?<td>(.*?)<.*?<time.*?>(.*?)<.*?<td>committer</td>.*?<td>(.*?)<.*<div.class="page_body">(.*?)</div>.*#mx ' ,
311311 $ t_gitphp_data , $ t_matches );
312-
312+
313313 $ t_commit ['author ' ] = $ t_matches [1 ];
314314 # gitphp doesn't parse email address for some reason?
315315 $ t_commit ['author_email ' ] = "n/a " ;
@@ -319,7 +319,7 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) {
319319 $ t_commit ['message ' ] = trim ( preg_replace ( '#<br.*?># ' , PHP_EOL , $ t_matches [4 ] ) );
320320
321321 $ t_parents = array ();
322-
322+
323323 if ( preg_match_all ( '#parent</td>.*?<td.class="monospace">.*?<a.*?>(.*?)<.*#mx ' , $ t_gitphp_data , $ t_matches ) ) {
324324 foreach ( $ t_matches [1 ] as $ t_match ) {
325325 $ t_parents [] = $ t_commit ['parent ' ] = $ t_match ;
@@ -335,13 +335,13 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) {
335335
336336 # Parse for changed file data
337337 $ t_commit ['files ' ] = array ();
338-
338+
339339 preg_match_all ( '#class="list".*?h=(\w*).*?f=(.*?)".*?<.a># ' ,
340340 $ t_gitphp_files , $ t_matches , PREG_SET_ORDER );
341-
341+
342342 foreach ( $ t_matches as $ t_file_matches ) {
343343 $ t_file = array ();
344- $ t_file ['filename ' ] = str_replace ('%2F ' , '/ ' , $ t_file_matches [2 ]);
344+ $ t_file ['filename ' ] = str_replace ('%2F ' , '/ ' , $ t_file_matches [2 ]);
345345 $ t_file ['revision ' ] = $ t_file_matches [1 ];
346346
347347 if ( isset ( $ t_file_matches [3 ] ) ) {
0 commit comments