| @@ 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 | } |
|
| @@ 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. |
|