Code Duplication    Length = 20-20 lines in 2 locations

class.jetpack.php 1 location

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

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
}