| @@ 1275-1294 (lines=20) @@ | ||
| 1272 | * Returns true if the site has file write access false otherwise. |
|
| 1273 | * @return string ( '1' | '0' ) |
|
| 1274 | **/ |
|
| 1275 | public static function file_system_write_access() { |
|
| 1276 | if ( ! function_exists( 'get_filesystem_method' ) ) { |
|
| 1277 | require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 1278 | } |
|
| 1279 | ||
| 1280 | require_once( ABSPATH . 'wp-admin/includes/template.php' ); |
|
| 1281 | ||
| 1282 | $filesystem_method = get_filesystem_method(); |
|
| 1283 | if ( $filesystem_method === 'direct' ) { |
|
| 1284 | return 1; |
|
| 1285 | } |
|
| 1286 | ||
| 1287 | ob_start(); |
|
| 1288 | $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); |
|
| 1289 | ob_end_clean(); |
|
| 1290 | if ( $filesystem_credentials_are_stored ) { |
|
| 1291 | return 1; |
|
| 1292 | } |
|
| 1293 | return 0; |
|
| 1294 | } |
|
| 1295 | ||
| 1296 | /** |
|
| 1297 | * Finds out if a site is using a version control system. |
|
| @@ 46-65 (lines=20) @@ | ||
| 43 | * Returns true if the site has file write access false otherwise. |
|
| 44 | * @return string ( '1' | '0' ) |
|
| 45 | **/ |
|
| 46 | public static function file_system_write_access() { |
|
| 47 | if ( ! function_exists( 'get_filesystem_method' ) ) { |
|
| 48 | require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 49 | } |
|
| 50 | ||
| 51 | require_once( ABSPATH . 'wp-admin/includes/template.php' ); |
|
| 52 | ||
| 53 | $filesystem_method = get_filesystem_method(); |
|
| 54 | if ( $filesystem_method === 'direct' ) { |
|
| 55 | return 1; |
|
| 56 | } |
|
| 57 | ||
| 58 | ob_start(); |
|
| 59 | $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); |
|
| 60 | ob_end_clean(); |
|
| 61 | if ( $filesystem_credentials_are_stored ) { |
|
| 62 | return 1; |
|
| 63 | } |
|
| 64 | return 0; |
|
| 65 | } |
|
| 66 | } |
|