PageRenderTime 44ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-admin/includes/class-wp-filesystem-base.php

https://gitlab.com/Blueprint-Marketing/WordPress-1
PHP | 763 lines | 272 code | 59 blank | 432 comment | 34 complexity | da97897fa2d9cd1f49dd9828b67f8834 MD5 | raw file
  1. <?php
  2. /**
  3. * Base WordPress Filesystem
  4. *
  5. * @package WordPress
  6. * @subpackage Filesystem
  7. */
  8. /**
  9. * Base WordPress Filesystem class for which Filesystem implementations extend
  10. *
  11. * @since 2.5.0
  12. */
  13. class WP_Filesystem_Base {
  14. /**
  15. * Whether to display debug data for the connection.
  16. *
  17. * @access public
  18. * @since 2.5.0
  19. * @var bool
  20. */
  21. var $verbose = false;
  22. /**
  23. * Cached list of local filepaths to mapped remote filepaths.
  24. *
  25. * @access private
  26. * @since 2.7.0
  27. * @var array
  28. */
  29. var $cache = array();
  30. /**
  31. * The Access method of the current connection, Set automatically.
  32. *
  33. * @access public
  34. * @since 2.5.0
  35. * @var string
  36. */
  37. var $method = '';
  38. /**
  39. * Constructor (empty).
  40. */
  41. function __construct() {}
  42. /**
  43. * Return the path on the remote filesystem of ABSPATH.
  44. *
  45. * @access public
  46. * @since 2.7.0
  47. *
  48. * @return string The location of the remote path.
  49. */
  50. function abspath() {
  51. $folder = $this->find_folder(ABSPATH);
  52. // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
  53. if ( ! $folder && $this->is_dir('/wp-includes') )
  54. $folder = '/';
  55. return $folder;
  56. }
  57. /**
  58. * Return the path on the remote filesystem of WP_CONTENT_DIR.
  59. *
  60. * @access public
  61. * @since 2.7.0
  62. *
  63. * @return string The location of the remote path.
  64. */
  65. function wp_content_dir() {
  66. return $this->find_folder(WP_CONTENT_DIR);
  67. }
  68. /**
  69. * Return the path on the remote filesystem of WP_PLUGIN_DIR.
  70. *
  71. * @access public
  72. * @since 2.7.0
  73. *
  74. * @return string The location of the remote path.
  75. */
  76. function wp_plugins_dir() {
  77. return $this->find_folder(WP_PLUGIN_DIR);
  78. }
  79. /**
  80. * Return the path on the remote filesystem of the Themes Directory.
  81. *
  82. * @access public
  83. * @since 2.7.0
  84. *
  85. * @param string $theme The Theme stylesheet or template for the directory.
  86. * @return string The location of the remote path.
  87. */
  88. function wp_themes_dir( $theme = false ) {
  89. $theme_root = get_theme_root( $theme );
  90. // Account for relative theme roots
  91. if ( '/themes' == $theme_root || ! is_dir( $theme_root ) )
  92. $theme_root = WP_CONTENT_DIR . $theme_root;
  93. return $this->find_folder( $theme_root );
  94. }
  95. /**
  96. * Return the path on the remote filesystem of WP_LANG_DIR.
  97. *
  98. * @access public
  99. * @since 3.2.0
  100. *
  101. * @return string The location of the remote path.
  102. */
  103. function wp_lang_dir() {
  104. return $this->find_folder(WP_LANG_DIR);
  105. }
  106. /**
  107. * Locate a folder on the remote filesystem.
  108. *
  109. * @access public
  110. * @since 2.5.0
  111. * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() instead.
  112. * @see WP_Filesystem::abspath()
  113. * @see WP_Filesystem::wp_content_dir()
  114. * @see WP_Filesystem::wp_plugins_dir()
  115. * @see WP_Filesystem::wp_themes_dir()
  116. * @see WP_Filesystem::wp_lang_dir()
  117. *
  118. * @param string $base The folder to start searching from.
  119. * @param bool $echo True to display debug information.
  120. * Default false.
  121. * @return string The location of the remote path.
  122. */
  123. function find_base_dir( $base = '.', $echo = false ) {
  124. _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
  125. $this->verbose = $echo;
  126. return $this->abspath();
  127. }
  128. /**
  129. * Locate a folder on the remote filesystem.
  130. *
  131. * @access public
  132. * @since 2.5.0
  133. * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
  134. * @see WP_Filesystem::abspath()
  135. * @see WP_Filesystem::wp_content_dir()
  136. * @see WP_Filesystem::wp_plugins_dir()
  137. * @see WP_Filesystem::wp_themes_dir()
  138. * @see WP_Filesystem::wp_lang_dir()
  139. *
  140. * @param string $base The folder to start searching from.
  141. * @param bool $echo True to display debug information.
  142. * @return string The location of the remote path.
  143. */
  144. function get_base_dir( $base = '.', $echo = false ) {
  145. _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
  146. $this->verbose = $echo;
  147. return $this->abspath();
  148. }
  149. /**
  150. * Locate a folder on the remote filesystem.
  151. *
  152. * Assumes that on Windows systems, Stripping off the Drive
  153. * letter is OK Sanitizes \\ to / in windows filepaths.
  154. *
  155. * @access public
  156. * @since 2.7.0
  157. *
  158. * @param string $folder the folder to locate.
  159. * @return string The location of the remote path.
  160. */
  161. function find_folder( $folder ) {
  162. if ( isset( $this->cache[ $folder ] ) )
  163. return $this->cache[ $folder ];
  164. if ( stripos($this->method, 'ftp') !== false ) {
  165. $constant_overrides = array(
  166. 'FTP_BASE' => ABSPATH,
  167. 'FTP_CONTENT_DIR' => WP_CONTENT_DIR,
  168. 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR,
  169. 'FTP_LANG_DIR' => WP_LANG_DIR
  170. );
  171. // Direct matches ( folder = CONSTANT/ )
  172. foreach ( $constant_overrides as $constant => $dir ) {
  173. if ( ! defined( $constant ) )
  174. continue;
  175. if ( $folder === $dir )
  176. return trailingslashit( constant( $constant ) );
  177. }
  178. // Prefix Matches ( folder = CONSTANT/subdir )
  179. foreach ( $constant_overrides as $constant => $dir ) {
  180. if ( ! defined( $constant ) )
  181. continue;
  182. if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir
  183. $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder );
  184. $potential_folder = trailingslashit( $potential_folder );
  185. if ( $this->is_dir( $potential_folder ) ) {
  186. $this->cache[ $folder ] = $potential_folder;
  187. return $potential_folder;
  188. }
  189. }
  190. }
  191. } elseif ( 'direct' == $this->method ) {
  192. $folder = str_replace('\\', '/', $folder); // Windows path sanitisation
  193. return trailingslashit($folder);
  194. }
  195. $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there.
  196. $folder = str_replace('\\', '/', $folder); // Windows path sanitisation
  197. if ( isset($this->cache[ $folder ] ) )
  198. return $this->cache[ $folder ];
  199. if ( $this->exists($folder) ) { // Folder exists at that absolute path.
  200. $folder = trailingslashit($folder);
  201. $this->cache[ $folder ] = $folder;
  202. return $folder;
  203. }
  204. if ( $return = $this->search_for_folder($folder) )
  205. $this->cache[ $folder ] = $return;
  206. return $return;
  207. }
  208. /**
  209. * Locate a folder on the remote filesystem.
  210. *
  211. * Expects Windows sanitized path.
  212. *
  213. * @access private
  214. * @since 2.7.0
  215. *
  216. * @param string $folder The folder to locate.
  217. * @param string $base The folder to start searching from.
  218. * @param bool $loop If the function has recursed, Internal use only.
  219. * @return string The location of the remote path.
  220. */
  221. function search_for_folder( $folder, $base = '.', $loop = false ) {
  222. if ( empty( $base ) || '.' == $base )
  223. $base = trailingslashit($this->cwd());
  224. $folder = untrailingslashit($folder);
  225. if ( $this->verbose )
  226. printf( "\n" . __('Looking for %1$s in %2$s') . "<br/>\n", $folder, $base );
  227. $folder_parts = explode('/', $folder);
  228. $folder_part_keys = array_keys( $folder_parts );
  229. $last_index = array_pop( $folder_part_keys );
  230. $last_path = $folder_parts[ $last_index ];
  231. $files = $this->dirlist( $base );
  232. foreach ( $folder_parts as $index => $key ) {
  233. if ( $index == $last_index )
  234. continue; // We want this to be caught by the next code block.
  235. // Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
  236. // If it's found, change into it and follow through looking for it.
  237. // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
  238. // If it reaches the end, and still cant find it, it'll return false for the entire function.
  239. if ( isset($files[ $key ]) ){
  240. // Lets try that folder:
  241. $newdir = trailingslashit(path_join($base, $key));
  242. if ( $this->verbose )
  243. printf( "\n" . __('Changing to %s') . "<br/>\n", $newdir );
  244. // only search for the remaining path tokens in the directory, not the full path again
  245. $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
  246. if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) )
  247. return $ret;
  248. }
  249. }
  250. // Only check this as a last resort, to prevent locating the incorrect install. All above procedures will fail quickly if this is the right branch to take.
  251. if (isset( $files[ $last_path ] ) ) {
  252. if ( $this->verbose )
  253. printf( "\n" . __('Found %s') . "<br/>\n", $base . $last_path );
  254. return trailingslashit($base . $last_path);
  255. }
  256. // Prevent this function from looping again.
  257. // No need to proceed if we've just searched in /
  258. if ( $loop || '/' == $base )
  259. return false;
  260. // As an extra last resort, Change back to / if the folder wasn't found.
  261. // This comes into effect when the CWD is /home/user/ but WP is at /var/www/....
  262. return $this->search_for_folder( $folder, '/', true );
  263. }
  264. /**
  265. * Return the *nix-style file permissions for a file.
  266. *
  267. * From the PHP documentation page for fileperms().
  268. *
  269. * @link http://docs.php.net/fileperms
  270. *
  271. * @access public
  272. * @since 2.5.0
  273. *
  274. * @param string $file String filename.
  275. * @return string The *nix-style representation of permissions.
  276. */
  277. function gethchmod( $file ){
  278. $perms = $this->getchmod($file);
  279. if (($perms & 0xC000) == 0xC000) // Socket
  280. $info = 's';
  281. elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
  282. $info = 'l';
  283. elseif (($perms & 0x8000) == 0x8000) // Regular
  284. $info = '-';
  285. elseif (($perms & 0x6000) == 0x6000) // Block special
  286. $info = 'b';
  287. elseif (($perms & 0x4000) == 0x4000) // Directory
  288. $info = 'd';
  289. elseif (($perms & 0x2000) == 0x2000) // Character special
  290. $info = 'c';
  291. elseif (($perms & 0x1000) == 0x1000) // FIFO pipe
  292. $info = 'p';
  293. else // Unknown
  294. $info = 'u';
  295. // Owner
  296. $info .= (($perms & 0x0100) ? 'r' : '-');
  297. $info .= (($perms & 0x0080) ? 'w' : '-');
  298. $info .= (($perms & 0x0040) ?
  299. (($perms & 0x0800) ? 's' : 'x' ) :
  300. (($perms & 0x0800) ? 'S' : '-'));
  301. // Group
  302. $info .= (($perms & 0x0020) ? 'r' : '-');
  303. $info .= (($perms & 0x0010) ? 'w' : '-');
  304. $info .= (($perms & 0x0008) ?
  305. (($perms & 0x0400) ? 's' : 'x' ) :
  306. (($perms & 0x0400) ? 'S' : '-'));
  307. // World
  308. $info .= (($perms & 0x0004) ? 'r' : '-');
  309. $info .= (($perms & 0x0002) ? 'w' : '-');
  310. $info .= (($perms & 0x0001) ?
  311. (($perms & 0x0200) ? 't' : 'x' ) :
  312. (($perms & 0x0200) ? 'T' : '-'));
  313. return $info;
  314. }
  315. /**
  316. * Convert *nix-style file permissions to a octal number.
  317. *
  318. * Converts '-rw-r--r--' to 0644
  319. * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod()
  320. *
  321. * @link http://docs.php.net/manual/en/function.chmod.php#49614
  322. *
  323. * @access public
  324. * @since 2.5.0
  325. *
  326. * @param string $mode string The *nix-style file permission.
  327. * @return int octal representation
  328. */
  329. function getnumchmodfromh( $mode ) {
  330. $realmode = '';
  331. $legal = array('', 'w', 'r', 'x', '-');
  332. $attarray = preg_split('//', $mode);
  333. for ($i=0; $i < count($attarray); $i++)
  334. if ($key = array_search($attarray[$i], $legal))
  335. $realmode .= $legal[$key];
  336. $mode = str_pad($realmode, 10, '-', STR_PAD_LEFT);
  337. $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
  338. $mode = strtr($mode,$trans);
  339. $newmode = $mode[0];
  340. $newmode .= $mode[1] + $mode[2] + $mode[3];
  341. $newmode .= $mode[4] + $mode[5] + $mode[6];
  342. $newmode .= $mode[7] + $mode[8] + $mode[9];
  343. return $newmode;
  344. }
  345. /**
  346. * Determine if the string provided contains binary characters.
  347. *
  348. * @access private
  349. * @since 2.7.0
  350. *
  351. * @param string $text String to test against.
  352. * @return bool true if string is binary, false otherwise.
  353. */
  354. function is_binary( $text ) {
  355. return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
  356. }
  357. /**
  358. * Change the ownership of a file / folder.
  359. *
  360. * Default behavior is to do nothing, override this in your subclass, if desired.
  361. *
  362. * @since 2.5.0
  363. *
  364. * @param string $file Path to the file.
  365. * @param mixed $owner A user name or number.
  366. * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False.
  367. * @return bool Returns true on success or false on failure.
  368. */
  369. function chown( $file, $owner, $recursive = false ) {
  370. return false;
  371. }
  372. /**
  373. * Connect filesystem.
  374. *
  375. * @since 2.5.0
  376. *
  377. * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
  378. */
  379. function connect() {
  380. return true;
  381. }
  382. /**
  383. * Read entire file into a string.
  384. *
  385. * @since 2.5.0
  386. *
  387. * @param string $file Name of the file to read.
  388. * @return string|bool Returns the read data or false on failure.
  389. */
  390. function get_contents( $file ) {
  391. return false;
  392. }
  393. /**
  394. * Read entire file into an array.
  395. *
  396. * @since 2.5.0
  397. *
  398. * @param string $file Path to the file.
  399. * @return array|bool the file contents in an array or false on failure.
  400. */
  401. function get_contents_array( $file ) {
  402. return false;
  403. }
  404. /**
  405. * Write a string to a file.
  406. *
  407. * @since 2.5.0
  408. *
  409. * @param string $file Remote path to the file where to write the data.
  410. * @param string $contents The data to write.
  411. * @param int $mode Optional. The file permissions as octal number, usually 0644.
  412. * @return bool False on failure.
  413. */
  414. function put_contents( $file, $contents, $mode = false ) {
  415. return false;
  416. }
  417. /**
  418. * Get the current working directory.
  419. *
  420. * @since 2.5.0
  421. *
  422. * @return string|bool The current working directory on success, or false on failure.
  423. */
  424. function cwd() {
  425. return false;
  426. }
  427. /**
  428. * Change current directory.
  429. *
  430. * @since 2.5.0
  431. *
  432. * @param string $dir The new current directory.
  433. * @return bool Returns true on success or false on failure.
  434. */
  435. function chdir( $dir ) {
  436. return false;
  437. }
  438. /**
  439. * Change the file group.
  440. *
  441. * @since 2.5.0
  442. *
  443. * @param string $file Path to the file.
  444. * @param mixed $group A group name or number.
  445. * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False.
  446. * @return bool Returns true on success or false on failure.
  447. */
  448. function chgrp( $file, $group, $recursive = false ) {
  449. return false;
  450. }
  451. /**
  452. * Change filesystem permissions.
  453. *
  454. * @since 2.5.0
  455. *
  456. * @param string $file Path to the file.
  457. * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
  458. * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False.
  459. * @return bool Returns true on success or false on failure.
  460. */
  461. function chmod( $file, $mode = false, $recursive = false ) {
  462. return false;
  463. }
  464. /**
  465. * Get the file owner.
  466. *
  467. * @since 2.5.0
  468. *
  469. * @param string $file Path to the file.
  470. * @return string|bool Username of the user or false on error.
  471. */
  472. function owner( $file ) {
  473. return false;
  474. }
  475. /**
  476. * Get the file's group.
  477. *
  478. * @since 2.5.0
  479. *
  480. * @param string $file Path to the file.
  481. * @return string|bool The group or false on error.
  482. */
  483. function group( $file ) {
  484. return false;
  485. }
  486. /**
  487. * Copy a file.
  488. *
  489. * @since 2.5.0
  490. *
  491. * @param string $source Path to the source file.
  492. * @param string $destination Path to the destination file.
  493. * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
  494. * Default false.
  495. * @param int $mode Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
  496. * Default false.
  497. * @return bool True if file copied successfully, False otherwise.
  498. */
  499. function copy( $source, $destination, $overwrite = false, $mode = false ) {
  500. return false;
  501. }
  502. /**
  503. * Move a file.
  504. *
  505. * @since 2.5.0
  506. *
  507. * @param string $source Path to the source file.
  508. * @param string $destination Path to the destination file.
  509. * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
  510. * Default false.
  511. * @return bool True if file copied successfully, False otherwise.
  512. */
  513. function move( $source, $destination, $overwrite = false ) {
  514. return false;
  515. }
  516. /**
  517. * Delete a file or directory.
  518. *
  519. * @since 2.5.0
  520. *
  521. * @param string $file Path to the file.
  522. * @param bool $recursive Optional. If set True changes file group recursively. Defaults to False.
  523. * Default false.
  524. * @param bool $type Type of resource. 'f' for file, 'd' for directory.
  525. * Default false.
  526. * @return bool True if the file or directory was deleted, false on failure.
  527. */
  528. function delete( $file, $recursive = false, $type = false ) {
  529. return false;
  530. }
  531. /**
  532. * Check if a file or directory exists.
  533. *
  534. * @since 2.5.0
  535. *
  536. * @param string $file Path to file/directory.
  537. * @return bool Whether $file exists or not.
  538. */
  539. function exists( $file ) {
  540. return false;
  541. }
  542. /**
  543. * Check if resource is a file.
  544. *
  545. * @since 2.5.0
  546. *
  547. * @param string $file File path.
  548. * @return bool Whether $file is a file.
  549. */
  550. function is_file( $file ) {
  551. return false;
  552. }
  553. /**
  554. * Check if resource is a directory.
  555. *
  556. * @since 2.5.0
  557. *
  558. * @param string $path Directory path.
  559. * @return bool Whether $path is a directory.
  560. */
  561. function is_dir( $path ) {
  562. return false;
  563. }
  564. /**
  565. * Check if a file is readable.
  566. *
  567. * @since 2.5.0
  568. *
  569. * @param string $file Path to file.
  570. * @return bool Whether $file is readable.
  571. */
  572. function is_readable( $file ) {
  573. return false;
  574. }
  575. /**
  576. * Check if a file or directory is writable.
  577. *
  578. * @since 2.5.0
  579. *
  580. * @param string $path Path to file/directory.
  581. * @return bool Whether $file is writable.
  582. */
  583. function is_writable( $file ) {
  584. return false;
  585. }
  586. /**
  587. * Gets the file's last access time.
  588. *
  589. * @since 2.5.0
  590. *
  591. * @param string $file Path to file.
  592. * @return int Unix timestamp representing last access time.
  593. */
  594. function atime( $file ) {
  595. return false;
  596. }
  597. /**
  598. * Gets the file modification time.
  599. *
  600. * @since 2.5.0
  601. *
  602. * @param string $file Path to file.
  603. * @return int Unix timestamp representing modification time.
  604. */
  605. function mtime( $file ) {
  606. return false;
  607. }
  608. /**
  609. * Gets the file size (in bytes).
  610. *
  611. * @since 2.5.0
  612. *
  613. * @param string $file Path to file.
  614. * @return int Size of the file in bytes.
  615. */
  616. function size( $file ) {
  617. return false;
  618. }
  619. /**
  620. * Set the access and modification times of a file.
  621. *
  622. * Note: If $file doesn't exist, it will be created.
  623. *
  624. * @since 2.5.0
  625. *
  626. * @param string $file Path to file.
  627. * @param int $time Optional. Modified time to set for file.
  628. * Default 0.
  629. * @param int $atime Optional. Access time to set for file.
  630. * Default 0.
  631. * @return bool Whether operation was successful or not.
  632. */
  633. function touch( $file, $time = 0, $atime = 0 ) {
  634. return false;
  635. }
  636. /**
  637. * Create a directory.
  638. *
  639. * @since 2.5.0
  640. *
  641. * @param string $path Path for new directory.
  642. * @param mixed $chmod Optional. The permissions as octal number, (or False to skip chmod)
  643. * Default false.
  644. * @param mixed $chown Optional. A user name or number (or False to skip chown)
  645. * Default false.
  646. * @param mixed $chgrp Optional. A group name or number (or False to skip chgrp).
  647. * Default false.
  648. * @return bool False if directory cannot be created, true otherwise.
  649. */
  650. function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
  651. return false;
  652. }
  653. /**
  654. * Delete a directory.
  655. *
  656. * @since 2.5.0
  657. *
  658. * @param string $path Path to directory.
  659. * @param bool $recursive Optional. Whether to recursively remove files/directories.
  660. * Default false.
  661. * @return bool Whether directory is deleted successfully or not.
  662. */
  663. function rmdir( $path, $recursive = false ) {
  664. return false;
  665. }
  666. /**
  667. * Get details for files in a directory or a specific file.
  668. *
  669. * @since 2.5.0
  670. *
  671. * @param string $path Path to directory or file.
  672. * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
  673. * Default true.
  674. * @param bool $recursive Optional. Whether to recursively include file details in nested directories.
  675. * Default false.
  676. * @return array|bool {
  677. * Array of files. False if unable to list directory contents.
  678. *
  679. * @type string 'name' Name of the file/directory.
  680. * @type string 'perms' *nix representation of permissions.
  681. * @type int 'permsn' Octal representation of permissions.
  682. * @type string 'owner' Owner name or ID.
  683. * @type int 'size' Size of file in bytes.
  684. * @type int 'lastmodunix' Last modified unix timestamp.
  685. * @type mixed 'lastmod' Last modified month (3 letter) and day (without leading 0).
  686. * @type int 'time' Last modified time.
  687. * @type string 'type' Type of resource. 'f' for file, 'd' for directory.
  688. * @type mixed 'files' If a directory and $recursive is true, contains another array of files.
  689. * }
  690. */
  691. function dirlist( $path, $include_hidden = true, $recursive = false ) {
  692. return false;
  693. }
  694. } // WP_Filesystem_Base