Code Duplication    Length = 20-20 lines in 2 locations

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

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

class.jetpack.php 1 location

@@ 1094-1113 (lines=20) @@
1091
	 * Returns true if the site has file write access false otherwise.
1092
	 * @return string ( '1' | '0' )
1093
	 **/
1094
	public static function file_system_write_access() {
1095
		if ( ! function_exists( 'get_filesystem_method' ) ) {
1096
			require_once( ABSPATH . 'wp-admin/includes/file.php' );
1097
		}
1098
1099
		require_once( ABSPATH . 'wp-admin/includes/template.php' );
1100
1101
		$filesystem_method = get_filesystem_method();
1102
		if ( $filesystem_method === 'direct' ) {
1103
			return 1;
1104
		}
1105
1106
		ob_start();
1107
		$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
1108
		ob_end_clean();
1109
		if ( $filesystem_credentials_are_stored ) {
1110
			return 1;
1111
		}
1112
		return 0;
1113
	}
1114
1115
	/**
1116
	 * Finds out if a site is using a version control system.