Make WordPress Core


Ignore:
Timestamp:
06/19/2020 10:34:26 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Add some space around control structures in WP_Filesystem_* classes for consistency and better readability.

Additionally, synchronize $tempfile and $temphandle variable names in WP_Filesystem_FTPext and WP_Filesystem_ftpsockets.

See #49542.

File:
1 edited

Legend:

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

    r47808 r48089  
    5656    public function abspath() {
    5757        $folder = $this->find_folder( ABSPATH );
     58
    5859        // Perhaps the FTP folder is rooted at the WordPress install.
    5960        // Check for wp-includes folder in root. Could have some false positives, but rare.
     
    6162            $folder = '/';
    6263        }
     64
    6365        return $folder;
    6466    }
     
    189191                    continue;
    190192                }
     193
    191194                if ( $folder === $dir ) {
    192195                    return trailingslashit( constant( $constant ) );
     
    199202                    continue;
    200203                }
     204
    201205                if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir.
    202206                    $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder );
     
    205209                    if ( $this->is_dir( $potential_folder ) ) {
    206210                        $this->cache[ $folder ] = $potential_folder;
     211
    207212                        return $potential_folder;
    208213                    }
     
    211216        } elseif ( 'direct' === $this->method ) {
    212217            $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
     218
    213219            return trailingslashit( $folder );
    214220        }
     
    224230            $folder                 = trailingslashit( $folder );
    225231            $this->cache[ $folder ] = $folder;
     232
    226233            return $folder;
    227234        }
     235
    228236        $return = $this->search_for_folder( $folder );
     237
    229238        if ( $return ) {
    230239            $this->cache[ $folder ] = $return;
    231240        }
     241
    232242        return $return;
    233243    }
     
    280290                // Let's try that folder:
    281291                $newdir = trailingslashit( path_join( $base, $key ) );
     292
    282293                if ( $this->verbose ) {
    283294                    /* translators: %s: Directory name. */
     
    288299                $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
    289300                $ret       = $this->search_for_folder( $newfolder, $newdir, $loop );
     301
    290302                if ( $ret ) {
    291303                    return $ret;
     
    301313                printf( "\n" . __( 'Found %s' ) . "<br/>\n", $base . $last_path );
    302314            }
     315
    303316            return trailingslashit( $base . $last_path );
    304317        }
     
    330343    public function gethchmod( $file ) {
    331344        $perms = intval( $this->getchmod( $file ), 8 );
     345
    332346        if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket.
    333347            $info = 's';
     
    368382                    ( ( $perms & 0x0200 ) ? 't' : 'x' ) :
    369383                    ( ( $perms & 0x0200 ) ? 'T' : '-' ) );
     384
    370385        return $info;
    371386    }
     
    403418        for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) {
    404419            $key = array_search( $attarray[ $i ], $legal, true );
     420
    405421            if ( $key ) {
    406422                $realmode .= $legal[ $key ];
     
    421437        $newmode .= $mode[4] + $mode[5] + $mode[6];
    422438        $newmode .= $mode[7] + $mode[8] + $mode[9];
     439
    423440        return $newmode;
    424441    }
Note: See TracChangeset for help on using the changeset viewer.