| @@ 51-70 (lines=20) @@ | ||
| 48 | * Returns true if the site has file write access false otherwise. |
|
| 49 | * @return string ( '1' | '0' ) |
|
| 50 | **/ |
|
| 51 | public static function file_system_write_access() { |
|
| 52 | if ( ! function_exists( 'get_filesystem_method' ) ) { |
|
| 53 | require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 54 | } |
|
| 55 | ||
| 56 | require_once( ABSPATH . 'wp-admin/includes/template.php' ); |
|
| 57 | ||
| 58 | $filesystem_method = get_filesystem_method(); |
|
| 59 | if ( $filesystem_method === 'direct' ) { |
|
| 60 | return 1; |
|
| 61 | } |
|
| 62 | ||
| 63 | ob_start(); |
|
| 64 | $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); |
|
| 65 | ob_end_clean(); |
|
| 66 | if ( $filesystem_credentials_are_stored ) { |
|
| 67 | return 1; |
|
| 68 | } |
|
| 69 | return 0; |
|
| 70 | } |
|
| 71 | } |
|
| @@ 1189-1208 (lines=20) @@ | ||
| 1186 | * Returns true if the site has file write access false otherwise. |
|
| 1187 | * @return string ( '1' | '0' ) |
|
| 1188 | **/ |
|
| 1189 | public static function file_system_write_access() { |
|
| 1190 | if ( ! function_exists( 'get_filesystem_method' ) ) { |
|
| 1191 | require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 1192 | } |
|
| 1193 | ||
| 1194 | require_once( ABSPATH . 'wp-admin/includes/template.php' ); |
|
| 1195 | ||
| 1196 | $filesystem_method = get_filesystem_method(); |
|
| 1197 | if ( $filesystem_method === 'direct' ) { |
|
| 1198 | return 1; |
|
| 1199 | } |
|
| 1200 | ||
| 1201 | ob_start(); |
|
| 1202 | $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); |
|
| 1203 | ob_end_clean(); |
|
| 1204 | if ( $filesystem_credentials_are_stored ) { |
|
| 1205 | return 1; |
|
| 1206 | } |
|
| 1207 | return 0; |
|
| 1208 | } |
|
| 1209 | ||
| 1210 | /** |
|
| 1211 | * Finds out if a site is using a version control system. |
|