cwd example



    /** * Checks if resource is a directory. * * @since 2.5.0 * * @param string $path Directory path. * @return bool Whether $path is a directory. */
    public function is_dir( $path ) {
        $cwd = $this->cwd();

        if ( $this->chdir( $path ) ) {
            $this->chdir( $cwd );
            return true;
        }

        return false;
    }

    /** * Checks if a file is readable. * * @since 2.5.0 * * @param string $file Path to file. * @return bool Whether $file is readable. */


    /** * Checks if resource is a directory. * * @since 2.5.0 * * @param string $path Directory path. * @return bool Whether $path is a directory. */
    public function is_dir( $path ) {
        $cwd    = $this->cwd();
        $result = @ftp_chdir( $this->link, trailingslashit( $path ) );

        if ( $result && $path === $this->cwd() || $this->cwd() !== $cwd ) {
            @ftp_chdir( $this->link, $cwd );
            return true;
        }

        return false;
    }

    /** * Checks if a file is readable. * * @since 2.5.0 * * @param string $file Path to file. * @return bool Whether $file is readable. */

    public function search_for_folder( $folder$base = '.', $loop = false ) {
        if ( empty( $base ) || '.' === $base ) {
            $base = trailingslashit( $this->cwd() );
        }

        $folder = untrailingslashit( $folder );

        if ( $this->verbose ) {
            /* translators: 1: Folder to locate, 2: Folder to start searching from. */
            printf( "\n" . __( 'Looking for %1$s in %2$s' ) . "<br />\n", $folder$base );
        }

        $folder_parts     = explode( '/', $folder );
        $folder_part_keys = array_keys( $folder_parts );
        
Home | Imprint | This part of the site doesn't use cookies.