| Server IP : 185.252.147.100 / Your IP : 216.73.217.33 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/east-point.site/public/wp-content/plugins/staatic/src/Bridge/ |
Upload File : |
<?php
namespace Staatic\WordPress\Bridge;
use Staatic\Vendor\GuzzleHttp\Psr7\Uri;
use Staatic\Vendor\Psr\Http\Message\UriInterface;
use Staatic\Crawler\CrawlProfile\AbstractCrawlProfile;
use Staatic\Crawler\UrlEvaluator\UrlEvaluatorInterface;
use Staatic\Crawler\UrlNormalizer\InternalUrlNormalizer;
use Staatic\Crawler\UrlTransformer\CallbackUrlTransformer;
use Staatic\Crawler\UrlTransformer\OfflineUrlTransformer;
use Staatic\Crawler\UrlTransformer\StandardUrlTransformer;
use Staatic\Crawler\UrlTransformer\UrlTransformation;
final class CrawlProfile extends AbstractCrawlProfile
{
public function __construct(UriInterface $baseUrl, UriInterface $destinationUrl, bool $lowercaseUrls, UrlEvaluatorInterface $urlEvaluator)
{
$this->baseUrl = $baseUrl;
$this->destinationUrl = $destinationUrl;
$this->urlEvaluator = $urlEvaluator;
$this->urlNormalizer = new InternalUrlNormalizer([
'lowercase' => $lowercaseUrls
]);
if ((string) $destinationUrl === '') {
$this->urlTransformer = new OfflineUrlTransformer();
} else {
$this->urlTransformer = new StandardUrlTransformer($baseUrl, $destinationUrl);
}
if ($lowercaseUrls) {
$originalTransformer = clone $this->urlTransformer;
$this->urlTransformer = new CallbackUrlTransformer(function (
UriInterface $url,
?UriInterface $foundOnUrl,
array $context
) use (
$originalTransformer
) {
$transformation = $originalTransformer->transform($url, $foundOnUrl, $context);
return new UrlTransformation(new Uri(mb_strtolower(
(string) $transformation->transformedUrl()
)), new Uri(
mb_strtolower(
(string) $transformation->effectiveUrl()
)
));
});
}
}
}