* * @return string */ private function get_uris_to_exclude( $use_trailing_slash ) { $site_url = site_url(); $uris = get_rocket_cache_reject_uri(); $uris = str_replace( [ '/(.*)|', '/(.*)/|' ], '/|', $uris ); foreach ( [ '/wp-admin', '/logout' ] as $uri ) { $uris .= "|{$uri}"; if ( $use_trailing_slash ) { $uris .= '/'; } } foreach ( [ wp_logout_url(), wp_login_url() ] as $uri ) { if ( strpos( $uri, '?' ) !== false ) { continue; } $uris .= '|' . str_replace( $site_url, '', $uri ); } return $uris; } /** * Checks if the given URL has a trailing slash. * * @since 3.7 * * @param string $url URL to check. * * @return bool */ private function has_trailing_slash( $url ) { return substr( $url, -1 ) === '/'; } /** * Indicates if the site uses a trailing slash in the permalink structure. * * @since 3.7 * * @return bool when true, uses `/`; else, no. */ private function use_trailing_slash() { return $this->has_trailing_slash( get_permalink() ); } }