Make WordPress Core

Changeset 28487


Ignore:
Timestamp:
05/19/2014 12:05:06 AM (12 years ago)
Author:
wonderboymusic
Message:

Add access modifiers to members and methods in WP_Filesystem_Base. Add magic __get() method for backwards compatibility.

See #27881, #22234.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-base.php

    r25560 r28487  
    2020         * @var bool
    2121         */
    22         var $verbose = false;
     22        public $verbose = false;
    2323
    2424        /**
    … …  
    2929         * @var array
    3030         */
    31         var $cache = array();
     31        private $cache = array();
    3232
    3333        /**
    … …  
    3838         * @var string
    3939         */
    40         var $method = '';
     40        public $method = '';
    4141
    4242        /**
    4343         * Constructor (empty).
    4444         */
    45         function __construct() {}
     45        public function __construct() {}
     46
     47        /**
     48         * Make private properties readable for backwards compatibility
     49         *
     50         * @since 4.0.0
     51         * @param string $name
     52         * @return mixed
     53         */
     54        public function __get( $name ) {
     55                return $this->$name;
     56        }
    4657
    4758        /**
    … …  
    5364         * @return string The location of the remote path.
    5465         */
    55         function abspath() {
     66        public function abspath() {
    5667                $folder = $this->find_folder(ABSPATH);
    5768                // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
    … …  
    6980         * @return string The location of the remote path.
    7081         */
    71         function wp_content_dir() {
     82        public function wp_content_dir() {
    7283                return $this->find_folder(WP_CONTENT_DIR);
    7384        }
    … …  
    8192         * @return string The location of the remote path.
    8293         */
    83         function wp_plugins_dir() {
     94        public function wp_plugins_dir() {
    8495                return $this->find_folder(WP_PLUGIN_DIR);
    8596        }
    … …  
    94105         * @return string The location of the remote path.
    95106         */
    96         function wp_themes_dir( $theme = false ) {
     107        public function wp_themes_dir( $theme = false ) {
    97108                $theme_root = get_theme_root( $theme );
    98109
    … …  
    112123         * @return string The location of the remote path.
    113124         */
    114         function wp_lang_dir() {
     125        public function wp_lang_dir() {
    115126                return $this->find_folder(WP_LANG_DIR);
    116127        }
    … …  
    133144         * @return string The location of the remote path.
    134145         */
    135         function find_base_dir( $base = '.', $echo = false ) {
     146        public function find_base_dir( $base = '.', $echo = false ) {
    136147                _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
    137148                $this->verbose = $echo;
    … …  
    155166         * @return string The location of the remote path.
    156167         */
    157         function get_base_dir( $base = '.', $echo = false ) {
     168        public function get_base_dir( $base = '.', $echo = false ) {
    158169                _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
    159170                $this->verbose = $echo;
    … …  
    173184         * @return string The location of the remote path.
    174185         */
    175         function find_folder( $folder ) {
     186        public function find_folder( $folder ) {
    176187
    177188                if ( isset( $this->cache[ $folder ] ) )
    … …  
    242253         * @return string The location of the remote path.
    243254         */
    244         function search_for_folder( $folder, $base = '.', $loop = false ) {
     255        public function search_for_folder( $folder, $base = '.', $loop = false ) {
    245256                if ( empty( $base ) || '.' == $base )
    246257                        $base = trailingslashit($this->cwd());
    … …  
    309320         * @return string The *nix-style representation of permissions.
    310321         */
    311         function gethchmod( $file ){
     322        public function gethchmod( $file ){
    312323                $perms = $this->getchmod($file);
    313324                if (($perms & 0xC000) == 0xC000) // Socket
    … …  
    365376         * @return int octal representation
    366377         */
    367         function getnumchmodfromh( $mode ) {
     378        public function getnumchmodfromh( $mode ) {
    368379                $realmode = '';
    369380                $legal =  array('', 'w', 'r', 'x', '-');
    … …  
    394405         * @return bool true if string is binary, false otherwise.
    395406         */
    396         function is_binary( $text ) {
     407        public function is_binary( $text ) {
    397408                return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
    398409        }
    … …  
    410421         * @return bool Returns true on success or false on failure.
    411422         */
    412         function chown( $file, $owner, $recursive = false ) {
     423        public function chown( $file, $owner, $recursive = false ) {
    413424                return false;
    414425        }
    … …  
    421432         * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
    422433         */
    423         function connect() {
     434        public function connect() {
    424435                return true;
    425436        }
    … …  
    433444         * @return string|bool Returns the read data or false on failure.
    434445         */
    435         function get_contents( $file ) {
     446        public function get_contents( $file ) {
    436447                return false;
    437448        }
    … …  
    445456         * @return array|bool the file contents in an array or false on failure.
    446457         */
    447         function get_contents_array( $file ) {
     458        public function get_contents_array( $file ) {
    448459                return false;
    449460        }
    … …  
    459470         * @return bool False on failure.
    460471         */
    461         function put_contents( $file, $contents, $mode = false ) {
     472        public function put_contents( $file, $contents, $mode = false ) {
    462473                return false;
    463474        }
    … …  
    470481         * @return string|bool The current working directory on success, or false on failure.
    471482         */
    472         function cwd() {
     483        public function cwd() {
    473484                return false;
    474485        }
    … …  
    482493         * @return bool Returns true on success or false on failure.
    483494         */
    484         function chdir( $dir ) {
     495        public function chdir( $dir ) {
    485496                return false;
    486497        }
    … …  
    496507         * @return bool Returns true on success or false on failure.
    497508         */
    498         function chgrp( $file, $group, $recursive = false ) {
     509        public function chgrp( $file, $group, $recursive = false ) {
    499510                return false;
    500511        }
    … …  
    510521         * @return bool Returns true on success or false on failure.
    511522         */
    512         function chmod( $file, $mode = false, $recursive = false ) {
     523        public function chmod( $file, $mode = false, $recursive = false ) {
    513524                return false;
    514525        }
    … …  
    522533         * @return string|bool Username of the user or false on error.
    523534         */
    524         function owner( $file ) {
     535        public function owner( $file ) {
    525536                return false;
    526537        }
    … …  
    534545         * @return string|bool The group or false on error.
    535546         */
    536         function group( $file ) {
     547        public function group( $file ) {
    537548                return false;
    538549        }
    … …  
    551562         * @return bool True if file copied successfully, False otherwise.
    552563         */
    553         function copy( $source, $destination, $overwrite = false, $mode = false ) {
     564        public function copy( $source, $destination, $overwrite = false, $mode = false ) {
    554565                return false;
    555566        }
    … …  
    566577         * @return bool True if file copied successfully, False otherwise.
    567578         */
    568         function move( $source, $destination, $overwrite = false ) {
     579        public function move( $source, $destination, $overwrite = false ) {
    569580                return false;
    570581        }
    … …  
    582593         * @return bool True if the file or directory was deleted, false on failure.
    583594         */
    584         function delete( $file, $recursive = false, $type = false ) {
     595        public function delete( $file, $recursive = false, $type = false ) {
    585596                return false;
    586597        }
    … …  
    594605         * @return bool Whether $file exists or not.
    595606         */
    596         function exists( $file ) {
     607        public function exists( $file ) {
    597608                return false;
    598609        }
    … …  
    606617         * @return bool Whether $file is a file.
    607618         */
    608         function is_file( $file ) {
     619        public function is_file( $file ) {
    609620                return false;
    610621        }
    … …  
    618629         * @return bool Whether $path is a directory.
    619630         */
    620         function is_dir( $path ) {
     631        public function is_dir( $path ) {
    621632                return false;
    622633        }
    … …  
    630641         * @return bool Whether $file is readable.
    631642         */
    632         function is_readable( $file ) {
     643        public function is_readable( $file ) {
    633644                return false;
    634645        }
    … …  
    642653         * @return bool Whether $file is writable.
    643654         */
    644         function is_writable( $file ) {
     655        public function is_writable( $file ) {
    645656                return false;
    646657        }
    … …  
    654665         * @return int Unix timestamp representing last access time.
    655666         */
    656         function atime( $file ) {
     667        public function atime( $file ) {
    657668                return false;
    658669        }
    … …  
    666677         * @return int Unix timestamp representing modification time.
    667678         */
    668         function mtime( $file ) {
     679        public function mtime( $file ) {
    669680                return false;
    670681        }
    … …  
    678689         * @return int Size of the file in bytes.
    679690         */
    680         function size( $file ) {
     691        public function size( $file ) {
    681692                return false;
    682693        }
    … …  
    696707         * @return bool Whether operation was successful or not.
    697708         */
    698         function touch( $file, $time = 0, $atime = 0 ) {
     709        public function touch( $file, $time = 0, $atime = 0 ) {
    699710                return false;
    700711        }
    … …  
    714725         * @return bool False if directory cannot be created, true otherwise.
    715726         */
    716         function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
     727        public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
    717728                return false;
    718729        }
    … …  
    728739         * @return bool Whether directory is deleted successfully or not.
    729740         */
    730         function rmdir( $path, $recursive = false ) {
     741        public function rmdir( $path, $recursive = false ) {
    731742                return false;
    732743        }
    … …  
    757768         * }
    758769         */
    759         function dirlist( $path, $include_hidden = true, $recursive = false ) {
     770        public function dirlist( $path, $include_hidden = true, $recursive = false ) {
    760771                return false;
    761772        }
Note: See TracChangeset for help on using the changeset viewer.