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