@@ -52,9 +52,7 @@ public function show_file( $p_repo, $p_changeset, $p_file ) {
5252 }
5353
5454 private function uri_base ( $ p_repo ) {
55- $ t_uri_base = $ p_repo ->info ['cgit_root ' ] . '' . $ p_repo ->info ['cgit_project ' ] . '/ ' ;
56-
57- return $ t_uri_base ;
55+ return $ p_repo ->info ['cgit_root ' ] . '' . $ p_repo ->info ['cgit_project ' ] . '/ ' ;
5856 }
5957
6058 public function url_repo ($ p_repo , $ p_changeset =null ) {
@@ -97,24 +95,42 @@ public function update_repo_form( $p_repo ) {
9795 }
9896?>
9997<tr>
100- <td class="category"><?php echo plugin_lang_get ( 'cgit_root ' ) ?> </td>
98+ <td class="category">
99+ <label for="cgit_root">
100+ <?php echo plugin_lang_get ( 'cgit_root ' ) ?>
101+ </label>
102+ </td>
101103 <td>
102- <input type="text" name="cgit_root" maxlength="250" size="40" value="<?php echo string_attribute ( $ t_cgit_root ) ?> "/>
104+ <input type="text" id="cgit_root" name="cgit_root"
105+ maxlength="250" size="40"
106+ value="<?php echo string_attribute ( $ t_cgit_root ) ?> "/>
103107 </td>
104108</tr>
105109 <tr>
106- <td class="category"><?php echo plugin_lang_get ( 'cgit_project ' ) ?> </td>
107- <td>
108- <input type="text" name="cgit_project" maxlength="250" size="40" value="<?php echo string_attribute ( $ t_cgit_project ) ?> "/>
110+ <td class="category">
111+ <label for="cgit_project">
112+ <?php echo plugin_lang_get ('cgit_project ' ) ?>
113+ </label>
114+ </td>
115+ <td>
116+ <input type="text" id="cgit_project" name="cgit_project"
117+ maxlength="250" size="40"
118+ value="<?php echo string_attribute ( $ t_cgit_project ) ?> "/>
109119 </td>
110120</tr>
111121<tr>
112- <td class="category"><?php echo plugin_lang_get ( 'master_branch ' ) ?> </td>
122+ <td class="category">
123+ <label for="master_branch">
124+ <?php echo plugin_lang_get ( 'master_branch ' ) ?>
125+ </label>
126+ </td>
113127 <td>
114- <input type="text" name="master_branch" maxlength="250" size="40" value="<?php echo string_attribute ( $ t_master_branch ) ?> "/>
128+ <input type="text" id="master_branch" name="master_branch"
129+ maxlength="250" size="40"
130+ value="<?php echo string_attribute ( $ t_master_branch ) ?> "/>
115131 </td>
116132</tr>
117- <?php
133+ <?php
118134 }
119135
120136 public function update_repo ( $ p_repo ) {
@@ -146,7 +162,7 @@ public function commit( $p_repo, $p_data ) {
146162 $ master_branches = array_map ( 'trim ' , explode ( ', ' , $ p_repo ->info ['master_branch ' ] ) );
147163 if (!in_array ($ t_branch ,$ master_branches ) )
148164 {
149- return ;
165+ return array () ;
150166 }
151167
152168 return $ this ->import_commits ($ p_repo , null , $ t_commit_id , $ t_branch );
@@ -165,10 +181,11 @@ public function import_full( $p_repo ) {
165181
166182 $ t_changeset_table = plugin_table ( 'changeset ' , 'Source ' );
167183
168- foreach ( $ t_branches as $ t_branch ) {
184+ /** @noinspection DuplicatedCode */
185+ foreach ($ t_branches as $ t_branch ) {
169186 $ t_query = "SELECT parent FROM $ t_changeset_table
170187 WHERE repo_id= " . db_param () . ' AND branch= ' . db_param () .
171- ' ORDER BY timestamp ASC ' ;
188+ ' ORDER BY timestamp ' ;
172189 $ t_result = db_query ( $ t_query , array ( $ p_repo ->id , $ t_branch ), 1 );
173190
174191 $ t_commits = array ( $ t_branch );
@@ -194,7 +211,8 @@ public function import_latest( $p_repo ) {
194211 return $ this ->import_full ( $ p_repo );
195212 }
196213
197- private function import_commits ( $ p_repo , $ p_uri_base , $ p_commit_ids , $ p_branch ='' ) {
214+ /** @noinspection PhpUnusedParameterInspection */
215+ private function import_commits ($ p_repo , $ p_uri_base , $ p_commit_ids , $ p_branch ='' ) {
198216 static $ s_parents = array ();
199217 static $ s_counter = 0 ;
200218
@@ -238,13 +256,14 @@ private function import_commits( $p_repo, $p_uri_base, $p_commit_ids, $p_branch=
238256 * @return string the revision
239257 */
240258 public function commit_revision ( $ p_input ) {
259+ /** @noinspection HtmlUnknownTarget */
241260 $ pattern = "#<tr><th>commit</th><td colspan='2' class='oid'><a href='/(.*?)/commit/\?id=([a-f0-9]*)'>([a-f0-9]*)</a># " ;
242261 preg_match ( $ pattern , $ p_input , $ t_matches );
243262 return $ t_matches [2 ];
244263 }
245264
246265 /**
247- * Parses the author and comitter from a cgit page.
266+ * Parses the author and comitter from a cgit page.§
248267 *
249268 * @param string $p_input cgit html page
250269 * @return array author / committer
@@ -297,8 +316,8 @@ public function commit_message( $p_input ) {
297316
298317 # Strip ref links and signoff spans from commit message
299318 $ t_message = preg_replace ( array (
300- '@<a[^>]*>([^<]*)<\ /a>@ ' ,
301- '@<span[^>]*>([^<]*<[^>]*>[^<]*)<\ /span>@ ' , #finds <span..>signed-off by <email></span>
319+ '@<a[^>]*>([^<]*)</a>@ ' ,
320+ '@<span[^>]*>([^<]*<[^>]*>[^<]*)</span>@ ' , #finds <span..>signed-off by <email></span>
302321 ), '$1 ' , $ t_message );
303322 return $ t_message ;
304323 }
@@ -345,7 +364,7 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) {
345364 $ t_input = $ this ->clean_input ( $ p_input );
346365
347366 // Get the revision
348- $ t_commit ['revision ' ] = $ this ->commit_revision ( $ t_input );;
367+ $ t_commit ['revision ' ] = $ this ->commit_revision ( $ t_input );
349368
350369 echo "processing $ t_commit [revision] ... " ;
351370
@@ -368,6 +387,7 @@ private function commit_changeset( $p_repo, $p_input, $p_branch='' ) {
368387 $ t_commit ['files ' ] = $ this ->commit_files ( $ t_input );
369388
370389 // Create the changeset
390+ /** @noinspection DuplicatedCode */
371391 $ t_changeset = new SourceChangeset ( $ p_repo ->id , $ t_commit ['revision ' ], $ p_branch ,
372392 $ t_commit ['date ' ], $ t_commit ['author ' ], $ t_commit ['message ' ], 0 ,
373393 ( isset ( $ t_commit ['parent ' ] ) ? $ t_commit ['parent ' ] : '' ) );
0 commit comments