get_filesystem_method example

'confirmDeleteTheme'   => __( 'Are you sure you want to delete this theme?' ),
                /* translators: %d: Number of theme search results, which cannot currently consider singular vs. plural forms. */
                'themeSearchResults'   => __( '%d themes found' ),
                /* translators: %d: Number of themes being displayed, which cannot currently consider singular vs. plural forms. */
                'announceThemeCount'   => __( 'Displaying %d themes' ),
                /* translators: %s: Theme name. */
                'announceThemeDetails' => __( 'Showing details for theme: %s' ),
            ),
        );

        // Temporarily disable installation in Customizer. See #42184.         $filesystem_method = get_filesystem_method();
        ob_start();
        $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
        ob_end_clean();
        if ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored ) {
            $settings['theme']['_filesystemCredentialsNeeded'] = true;
        }

        // Prepare Customize Section objects to pass to JavaScript.         foreach ( $this->sections() as $id => $section ) {
            if ( $section->check_capabilities() ) {
                $settings['sections'][ $id ] = $section->json();
            }

function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid     global $wp_filesystem;

    require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';

    $method = get_filesystem_method( $args$context$allow_relaxed_file_ownership );

    if ( ! $method ) {
        return false;
    }

    if ( ! class_exists( "WP_Filesystem_$method) ) {

        /** * Filters the path for a specific filesystem method class file. * * @since 2.6.0 * * @see get_filesystem_method() * * @param string $path Path to the specific filesystem method class file. * @param string $method The filesystem method to use. */
/** * Determine if the endpoints are available. * * Only the 'Direct' filesystem transport, and SSH/FTP when credentials are stored are supported at present. * * @since 5.5.0 * * @return true|WP_Error True if filesystem is available, WP_Error otherwise. */
    protected function is_filesystem_available() {
        $filesystem_method = get_filesystem_method();

        if ( 'direct' === $filesystem_method ) {
            return true;
        }

        ob_start();
        $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
        ob_end_clean();

        if ( $filesystem_credentials_are_stored ) {
            return true;
        }
Home | Imprint | This part of the site doesn't use cookies.