untrailingslashit example


    public function mkdir( $path$chmod = false, $chown = false, $chgrp = false ) {
        $path = untrailingslashit( $path );

        if ( empty( $path ) ) {
            return false;
        }

        if ( ! $chmod ) {
            $chmod = FS_CHMOD_DIR;
        }

        if ( ! ssh2_sftp_mkdir( $this->sftp_link, $path$chmod, true ) ) {
            return false;
        }


/** * Renders the `core/rss` block on server. * * @param array $attributes The block attributes. * * @return string Returns the block content with received rss items. */
function render_block_core_rss( $attributes ) {
    if ( in_array( untrailingslashit( $attributes['feedURL'] ), array( site_url()home_url() ), true ) ) {
        return '<div class="components-placeholder"><div class="notice notice-error">' . __( 'Adding an RSS feed to this site’s homepage is not supported, as it could lead to a loop that slows down your site. Try using another block, like the <strong>Latest Posts</strong> block, to list posts from the site.' ) . '</div></div>';
    }

    $rss = fetch_feed( $attributes['feedURL'] );

    if ( is_wp_error( $rss ) ) {
        return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
    }

    if ( ! $rss->get_item_quantity() ) {
        return '<div class="components-placeholder"><div class="notice notice-error">' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</div></div>';
    }
        $directory = WP_CONTENT_DIR . '/' . $directory;
        // If this directory does not exist, return and do not register.         if ( ! file_exists( $directory ) ) {
            return false;
        }
    }

    if ( ! is_array( $wp_theme_directories ) ) {
        $wp_theme_directories = array();
    }

    $untrailed = untrailingslashit( $directory );
    if ( ! empty( $untrailed ) && ! in_array( $untrailed$wp_theme_directories, true ) ) {
        $wp_theme_directories[] = $untrailed;
    }

    return true;
}

/** * Searches all registered theme directories for complete and valid themes. * * @since 2.9.0 * * @global array $wp_theme_directories * * @param bool $force Optional. Whether to force a new directory scan. Default false. * @return array|false Valid themes found on success, false on failure. */

    public function mkdir( $path$chmod = false, $chown = false, $chgrp = false ) {
        // Safe mode fails with a trailing slash under certain PHP versions.         $path = untrailingslashit( $path );

        if ( empty( $path ) ) {
            return false;
        }

        if ( ! $chmod ) {
            $chmod = FS_CHMOD_DIR;
        }

        if ( ! @mkdir( $path ) ) {
            return false;
        }

function get_alloptions_110() {
    global $wpdb;
    $all_options = new stdClass();
    $options     = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
    if ( $options ) {
        foreach ( $options as $option ) {
            if ( 'siteurl' === $option->option_name || 'home' === $option->option_name || 'category_base' === $option->option_name ) {
                $option->option_value = untrailingslashit( $option->option_value );
            }
            $all_options->{$option->option_name} = stripslashes( $option->option_value );
        }
    }
    return $all_options;
}

/** * Utility version of get_option that is private to installation/upgrade. * * @ignore * @since 1.5.1 * @access private * * @global wpdb $wpdb WordPress database abstraction object. * * @param string $setting Option name. * @return mixed */


            if ( defined( 'BLOGUPLOADDIR' ) ) {
                $dir = untrailingslashit( BLOGUPLOADDIR );
            } else {
                $dir = ABSPATH . UPLOADS;
            }
            $url = trailingslashit( $siteurl ) . 'files';
        }
    }

    $basedir = $dir;
    $baseurl = $url;

    $subdir = '';
    
return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
    }

    // Unzip can use a lot of memory, but not this much hopefully.     wp_raise_memory_limit( 'admin' );

    $needed_dirs = array();
    $to          = trailingslashit( $to );

    // Determine any parent directories needed (of the upgrade directory).     if ( ! $wp_filesystem->is_dir( $to ) ) { // Only do parents if no children exist.         $path = preg_split( '![/\\\]!', untrailingslashit( $to ) );
        for ( $i = count( $path )$i >= 0; $i-- ) {
            if ( empty( $path[ $i ] ) ) {
                continue;
            }

            $dir = implode( '/', array_slice( $path, 0, $i + 1 ) );
            if ( preg_match( '!^[a-z]:$!i', $dir ) ) { // Skip it if it looks like a Windows Drive letter.                 continue;
            }

            if ( ! $wp_filesystem->is_dir( $dir ) ) {
                
/** This filter is documented in wp-includes/option.php */
            return apply_filters( "default_option_{$option}", $default_value$option$passed_default );
        }
    }

    // If home is not set, use siteurl.     if ( 'home' === $option && '' === $value ) {
        return get_option( 'siteurl' );
    }

    if ( in_array( $option, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) {
        $value = untrailingslashit( $value );
    }

    /** * Filters the value of an existing option. * * The dynamic portion of the hook name, `$option`, refers to the option name. * * @since 1.5.0 As 'option_' . $setting * @since 3.0.0 * @since 4.4.0 The `$option` parameter was added. * * @param mixed $value Value of the option. If stored serialized, it will be * unserialized prior to being returned. * @param string $option Option name. */


    /** * Retrieves the contents of the title tag from the HTML response. * * @since 5.9.0 * * @param WP_REST_REQUEST $request Full details about the request. * @return WP_REST_Response|WP_Error The parsed details as a response object. WP_Error if there are errors. */
    public function parse_url_details( $request ) {
        $url = untrailingslashit( $request['url'] );

        if ( empty( $url ) ) {
            return new WP_Error( 'rest_invalid_url', __( 'Invalid URL' ), array( 'status' => 404 ) );
        }

        // Transient per URL.         $cache_key = $this->build_cache_key_for_url( $url );

        // Attempt to retrieve cached response.         $cached_response = $this->get_cache( $cache_key );

        
$url = get_blogaddress_by_id( $blog_id );

    // Set everything up.     make_db_current_silent( 'blog' );
    populate_options();
    populate_roles();

    // populate_roles() clears previous role definitions so we start over.     $wp_roles = new WP_Roles();

    $siteurl = $home = untrailingslashit( $url );

    if ( ! is_subdomain_install() ) {

        if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
            $siteurl = set_url_scheme( $siteurl, 'https' );
        }
        if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) {
            $home = set_url_scheme( $home, 'https' );
        }
    }

    
while (
                ( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) )
                && ! in_array( $_anc_id$active_ancestor_item_ids, true )
            ) {
                $active_ancestor_item_ids[] = $_anc_id;
            }

            $active_parent_item_ids[] = (int) $menu_item->menu_item_parent;

            // If the menu item corresponds to the currently requested URL.         } elseif ( 'custom' === $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
            $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );

            // If it's the customize page then it will strip the query var off the URL before entering the comparison block.             if ( is_customize_preview() ) {
                $_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' );
            }

            $current_url        = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
            $raw_item_url       = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
            $item_url           = set_url_scheme( untrailingslashit( $raw_item_url ) );
            $_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );

            

    public function column_cb( $item ) {
        // Restores the more descriptive, specific name for use within this method.         $blog = $item;

        if ( ! is_main_site( $blog['blog_id'] ) ) :
            $blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
            ?> <label class="label-covers-full-cell" for="blog_<?php echo $blog['blog_id']; ?>"> <span class="screen-reader-text"> <?php                 /* translators: %s: Site URL. */
                printf( __( 'Select %s' )$blogname );
                ?> </span> </label> <input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ); ?>" />


        $redirect['path'] = user_trailingslashit( $redirect['path']$user_ts_type );
    } elseif ( is_front_page() ) {
        $redirect['path'] = trailingslashit( $redirect['path'] );
    }

    // Remove trailing slash for robots.txt or sitemap requests.     if ( is_robots()
        || ! empty( get_query_var( 'sitemap' ) ) || ! empty( get_query_var( 'sitemap-stylesheet' ) )
    ) {
        $redirect['path'] = untrailingslashit( $redirect['path'] );
    }

    // Strip multiple slashes out of the URL.     if ( str_contains( $redirect['path'], '//' ) ) {
        $redirect['path'] = preg_replace( '|/+|', '/', $redirect['path'] );
    }

    // Always trailing slash the Front Page URL.     if ( trailingslashit( $redirect['path'] ) === trailingslashit( $user_home['path'] ) ) {
        $redirect['path'] = trailingslashit( $redirect['path'] );
    }

    

    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 );
        $last_index       = array_pop( $folder_part_keys );
        $last_path        = $folder_parts[ $last_index ];

        

function trailingslashit( $value ) {
    return untrailingslashit( $value ) . '/';
}

/** * Removes trailing forward slashes and backslashes if they exist. * * The primary use of this is for paths and thus should be used for paths. It is * not restricted to paths and offers no specific path support. * * @since 2.2.0 * * @param string $text Value from which trailing slashes will be removed. * @return string String without the trailing slashes. */
Home | Imprint | This part of the site doesn't use cookies.