WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (18 months ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r47088 r47122  
    5656    public function abspath() {
    5757        $folder = $this->find_folder( ABSPATH );
    58         // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
     58        // Perhaps the FTP folder is rooted at the WordPress install.
     59        // Check for wp-includes folder in root. Could have some false positives, but rare.
    5960        if ( ! $folder && $this->is_dir( '/' . WPINC ) ) {
    6061            $folder = '/';
     
    9798        $theme_root = get_theme_root( $theme );
    9899
    99         // Account for relative theme roots
     100        // Account for relative theme roots.
    100101        if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) {
    101102            $theme_root = WP_CONTENT_DIR . $theme_root;
     
    183184            );
    184185
    185             // Direct matches ( folder = CONSTANT/ )
     186            // Direct matches ( folder = CONSTANT/ ).
    186187            foreach ( $constant_overrides as $constant => $dir ) {
    187188                if ( ! defined( $constant ) ) {
     
    193194            }
    194195
    195             // Prefix Matches ( folder = CONSTANT/subdir )
     196            // Prefix matches ( folder = CONSTANT/subdir ),
    196197            foreach ( $constant_overrides as $constant => $dir ) {
    197198                if ( ! defined( $constant ) ) {
    198199                    continue;
    199200                }
    200                 if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir
     201                if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir.
    201202                    $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder );
    202203                    $potential_folder = trailingslashit( $potential_folder );
     
    209210            }
    210211        } elseif ( 'direct' == $this->method ) {
    211             $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation
     212            $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
    212213            return trailingslashit( $folder );
    213214        }
    214215
    215         $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out windows drive letter if it's there.
    216         $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation
     216        $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out Windows drive letter if it's there.
     217        $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
    217218
    218219        if ( isset( $this->cache[ $folder ] ) ) {
     
    241242     * @param string $folder The folder to locate.
    242243     * @param string $base   The folder to start searching from.
    243      * @param bool   $loop   If the function has recursed, Internal use only.
     244     * @param bool   $loop   If the function has recursed. Internal use only.
    244245     * @return string|false The location of the remote path, false to cease looping.
    245246     */
     
    304305
    305306        // Prevent this function from looping again.
    306         // No need to proceed if we've just searched in /
     307        // No need to proceed if we've just searched in `/`.
    307308        if ( $loop || '/' == $base ) {
    308309            return false;
     
    329330    public function gethchmod( $file ) {
    330331        $perms = intval( $this->getchmod( $file ), 8 );
    331         if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket
     332        if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket.
    332333            $info = 's';
    333         } elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link
     334        } elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link.
    334335            $info = 'l';
    335         } elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular
     336        } elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular.
    336337            $info = '-';
    337         } elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special
     338        } elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special.
    338339            $info = 'b';
    339         } elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory
     340        } elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory.
    340341            $info = 'd';
    341         } elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special
     342        } elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special.
    342343            $info = 'c';
    343         } elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe
     344        } elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe.
    344345            $info = 'p';
    345         } else { // Unknown
     346        } else { // Unknown.
    346347            $info = 'u';
    347348        }
    348349
    349         // Owner
     350        // Owner.
    350351        $info .= ( ( $perms & 0x0100 ) ? 'r' : '-' );
    351352        $info .= ( ( $perms & 0x0080 ) ? 'w' : '-' );
     
    354355                    ( ( $perms & 0x0800 ) ? 'S' : '-' ) );
    355356
    356         // Group
     357        // Group.
    357358        $info .= ( ( $perms & 0x0020 ) ? 'r' : '-' );
    358359        $info .= ( ( $perms & 0x0010 ) ? 'w' : '-' );
     
    361362                    ( ( $perms & 0x0400 ) ? 'S' : '-' ) );
    362363
    363         // World
     364        // World.
    364365        $info .= ( ( $perms & 0x0004 ) ? 'r' : '-' );
    365366        $info .= ( ( $perms & 0x0002 ) ? 'w' : '-' );
     
    828829    }
    829830
    830 } // WP_Filesystem_Base
     831}
Note: See TracChangeset for help on using the changeset viewer.