Code Duplication    Length = 20-20 lines in 2 locations

sync/class.jetpack-sync-functions.php 1 location

@@ 49-68 (lines=20) @@
46
	 * Returns true if the site has file write access false otherwise.
47
	 * @return string ( '1' | '0' )
48
	 **/
49
	public static function file_system_write_access() {
50
		if ( ! function_exists( 'get_filesystem_method' ) ) {
51
			require_once( ABSPATH . 'wp-admin/includes/file.php' );
52
		}
53
54
		require_once( ABSPATH . 'wp-admin/includes/template.php' );
55
56
		$filesystem_method = get_filesystem_method();
57
		if ( $filesystem_method === 'direct' ) {
58
			return 1;
59
		}
60
61
		ob_start();
62
		$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
63
		ob_end_clean();
64
		if ( $filesystem_credentials_are_stored ) {
65
			return 1;
66
		}
67
68
		return 0;
69
	}
70
}

class.jetpack.php 1 location

@@ 1050-1069 (lines=20) @@
1047
	 * Returns true if the site has file write access false otherwise.
1048
	 * @return string ( '1' | '0' )
1049
	 **/
1050
	public static function file_system_write_access() {
1051
		if ( ! function_exists( 'get_filesystem_method' ) ) {
1052
			require_once( ABSPATH . 'wp-admin/includes/file.php' );
1053
		}
1054
1055
		require_once( ABSPATH . 'wp-admin/includes/template.php' );
1056
1057
		$filesystem_method = get_filesystem_method();
1058
		if ( $filesystem_method === 'direct' ) {
1059
			return 1;
1060
		}
1061
1062
		ob_start();
1063
		$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
1064
		ob_end_clean();
1065
		if ( $filesystem_credentials_are_stored ) {
1066
			return 1;
1067
		}
1068
		return 0;
1069
	}
1070
1071
	/**
1072
	 * Finds out if a site is using a version control system.