Function Reference: geodir_init_filesystem
Summary
Initiate the WordPress file system and provide fallback if needed.
Package
GeoDirectory
Return Values
- (bool|string)
- Returns the file system class on success.
- False on failure.
Change Log
Since: 1.4.8
Source File
geodir_init_filesystem() is located in geodirectory-admin/admin_functions.php [Line: 3248]
Source Code
function geodir_init_filesystem() { if(!function_exists('get_filesystem_method')){ require_once(ABSPATH."/wp-admin/includes/file.php"); } $access_type = get_filesystem_method(); if ($access_type === 'direct') { /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); /* initialize the API */ if (!WP_Filesystem($creds)) { /* any problems and we exit */ //return '@@@3'; return false; } global $wp_filesystem; return $wp_filesystem; /* do our file manipulations below */ } elseif (defined('FTP_USER')) { $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); /* initialize the API */ if (!WP_Filesystem($creds)) { /* any problems and we exit */ //return '@@@33'; return false; } global $wp_filesystem; //return '@@@1'; return $wp_filesystem; } else { //return '@@@2'; /* don't have direct write access. Prompt user with our notice */ add_action('admin_notice', 'geodir_filesystem_notice'); return false; } }