PageRenderTime 63ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

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

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