@@ -9,8 +9,11 @@ class PHPCS_Diff_SVN {
99 // Used to store details about the repo the class was initialized with.
1010 public $ repo ; // Specific repository - eg.: plugin's name.
1111 public $ repo_url ; // SVN repository URL.
12+ public $ folder = '' ; // In case the repository has some other specific folders.
1213
13- function __construct ( $ repo ) {
14+ function __construct ( $ repo , $ folder = false ) {
15+
16+ $ repo = sanitize_title ( $ repo );
1417
1518 switch ( $ repo ) {
1619
@@ -22,9 +25,13 @@ function __construct( $repo ) {
2225 }
2326
2427 $ this ->repo = $ repo ;
28+
29+ if ( false !== $ folder && 0 === validate_file ( $ folder ) ) {
30+ $ this ->folder = $ folder ;
31+ }
2532 }
2633
27- public function get_diff ( $ folder , $ end_revision , $ start_revision = null , $ options = array () ) {
34+ public function get_diff ( $ end_revision , $ start_revision = null , $ options = array () ) {
2835 $ summarize = false ;
2936 $ xml = false ;
3037 $ ignore_space_change = false ;
@@ -43,7 +50,6 @@ public function get_diff( $folder, $end_revision, $start_revision = null, $optio
4350 }
4451
4552 $ end_revision = (int ) $ end_revision ;
46- $ folder = str_replace ( '.. ' , '' , $ folder ); // Prevent moving up a directory
4753
4854 if ( $ start_revision && is_numeric ( $ start_revision ) ) {
4955 $ start_revision = (int ) $ start_revision ;
@@ -52,7 +58,7 @@ public function get_diff( $folder, $end_revision, $start_revision = null, $optio
5258 $ start_revision = 1 ;
5359 }
5460
55- $ repo_url = esc_url_raw ( trailingslashit ( $ this ->repo_url ) . trailingslashit ( $ this ->repo ) . $ folder );
61+ $ repo_url = esc_url_raw ( trailingslashit ( $ this ->repo_url ) . trailingslashit ( $ this ->repo ) . $ this -> folder );
5662
5763 $ diff = shell_exec (
5864 sprintf ( 'svn diff %s --non-interactive --no-auth-cache --username %s --password %s -r %d:%d %s %s %s ' ,
0 commit comments