芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/public_html/wp-content/plugins/woocommerce/packages/blueprint/src/UseWPFunctions.php
filesystem_initialized ) { if ( ! class_exists( 'WP_Filesystem' ) ) { require_once ABSPATH . 'wp-admin/includes/file.php'; } $initialized = WP_Filesystem(); $this->filesystem_initialized = $initialized; return $initialized; } return true; } /** * Unzips a file to a specified location. * * @param string $path Path to the ZIP file. * @param string $to Destination directory. * @return bool|WP_Error True on success, WP_Error on failure. */ public function wp_unzip_file( $path, $to ) { $this->wp_init_filesystem(); return unzip_file( $path, $to ); } /** * Retrieves the upload directory information. * * @return array Array of upload directory information. */ public function wp_upload_dir() { return \wp_upload_dir(); } /** * Retrieves the root directory of the current theme. * * @return string The root directory of the current theme. */ public function wp_get_theme_root() { return \get_theme_root(); } /** * Checks if a variable is a WP_Error. * * @param mixed $thing Variable to check. * @return bool True if the variable is a WP_Error, false otherwise. */ public function is_wp_error( $thing ) { return is_wp_error( $thing ); } /** * Downloads a file from a URL. * * @param string $url The URL of the file to download. * @return string|WP_Error The local file path on success, WP_Error on failure. */ public function wp_download_url( $url ) { if ( ! function_exists( 'download_url' ) ) { include ABSPATH . '/wp-admin/includes/file.php'; } return download_url( $url ); } /** * Alias for WP_Filesystem::put_contents(). * * @param string $file_path The path to the file to write. * @param mixed $content The data to write to the file. * * @return bool True on success, false on failure. */ public function wp_filesystem_put_contents( $file_path, $content ) { global $wp_filesystem; if ( ! $this->wp_init_filesystem() ) { return false; } return $wp_filesystem->put_contents( $file_path, $content ); } /** * Alias for WP_Filesystem::get_contents(). * * @param string $file_path The path to the file to read. * @return string|false The contents of the file, or false on failure. */ public function wp_filesystem_get_contents( $file_path ) { global $wp_filesystem; if ( ! $this->wp_init_filesystem() ) { return false; } return $wp_filesystem->get_contents( $file_path ); } /** * Retrieves the current user's ID. * * @return int The current user's ID. */ public function wp_get_current_user_id() { return get_current_user_id(); } }