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
71
	public static function wp_version() {

class.jetpack.php 1 location

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