!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/classify.picotech.app/public_html/vendor/spatie/laravel-sitemap/src/   drwxr-xr-x
Free 28.86 GB of 117.98 GB (24.47%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     SitemapGenerator.php (5.32 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Spatie\Sitemap;

use 
Closure;
use 
GuzzleHttp\Psr7\Uri;
use 
Illuminate\Support\Collection;
use 
Psr\Http\Message\ResponseInterface;
use 
Psr\Http\Message\UriInterface;
use 
Spatie\Browsershot\Browsershot;
use 
Spatie\Crawler\Crawler;
use 
Spatie\Crawler\CrawlProfiles\CrawlProfile;
use 
Spatie\Sitemap\Crawler\Observer;
use 
Spatie\Sitemap\Crawler\Profile;
use 
Spatie\Sitemap\Tags\Url;

class 
SitemapGenerator
{
    protected 
Collection $sitemaps;

    protected 
Uri $urlToBeCrawled;

    protected 
Crawler $crawler;

    
/** @var callable */
    
protected $shouldCrawl;

    
/** @var callable */
    
protected $hasCrawled;

    protected 
int $concurrency 10;

    protected 
bool int $maximumTagsPerSitemap false;

    protected ?
int $maximumCrawlCount null;

    public static function 
create(string $urlToBeCrawled): static
    {
        return 
app(static::class)->setUrl($urlToBeCrawled);
    }

    public function 
__construct(Crawler $crawler)
    {
        
$this->crawler $crawler;

        
$this->sitemaps = new Collection([new Sitemap]);

        
$this->hasCrawled = fn (Url $urlResponseInterface $response null) => $url;
    }

    public function 
configureCrawler(Closure $closure): static
    {
        
call_user_func_array($closure, [$this->crawler]);

        return 
$this;
    }

    public function 
setConcurrency(int $concurrency): static
    {
        
$this->concurrency $concurrency;

        return 
$this;
    }

    public function 
setMaximumCrawlCount(int $maximumCrawlCount): static
    {
        
$this->maximumCrawlCount $maximumCrawlCount;

        return 
$this;
    }

    public function 
maxTagsPerSitemap(int $maximumTagsPerSitemap 50000): static
    {
        
$this->maximumTagsPerSitemap $maximumTagsPerSitemap;

        return 
$this;
    }

    public function 
setUrl(string $urlToBeCrawled): static
    {
        
$this->urlToBeCrawled = new Uri($urlToBeCrawled);

        if (
$this->urlToBeCrawled->getPath() === '') {
            
$this->urlToBeCrawled $this->urlToBeCrawled->withPath('/');
        }

        return 
$this;
    }

    public function 
shouldCrawl(callable $shouldCrawl): static
    {
        
$this->shouldCrawl $shouldCrawl;

        return 
$this;
    }

    public function 
hasCrawled(callable $hasCrawled): static
    {
        
$this->hasCrawled $hasCrawled;

        return 
$this;
    }

    public function 
getSitemap(): Sitemap
    
{
        if (
config('sitemap.execute_javascript')) {
            
$this->crawler->executeJavaScript();
        }

        if (
config('sitemap.chrome_binary_path')) {
            
$this->crawler
                
->setBrowsershot((new Browsershot)->setChromePath(config('sitemap.chrome_binary_path')))
                ->
acceptNofollowLinks();
        }

        if (! 
is_null($this->maximumCrawlCount)) {
            
$this->crawler->setTotalCrawlLimit($this->maximumCrawlCount);
        }

        
$this->crawler
            
->setCrawlProfile($this->getCrawlProfile())
            ->
setCrawlObserver($this->getCrawlObserver())
            ->
setConcurrency($this->concurrency)
            ->
startCrawling($this->urlToBeCrawled);

        return 
$this->sitemaps->first();
    }

    public function 
writeToFile(string $path): static
    {
        
$sitemap $this->getSitemap();

        if (
$this->maximumTagsPerSitemap) {
            
$sitemap SitemapIndex::create();
            
$format str_replace('.xml''_%d.xml'$path);

            
// Parses each sub-sitemaps, writes and push them into the sitemap index
            
$this->sitemaps->each(function (Sitemap $itemint $key) use ($sitemap$format) {
                
$path sprintf($format$key);

                
$item->writeToFile(sprintf($format$key));
                
$sitemap->add(last(explode('public'$path)));
            });
        }

        
$sitemap->writeToFile($path);

        return 
$this;
    }

    protected function 
getCrawlProfile(): CrawlProfile
    
{
        
$shouldCrawl = function (UriInterface $url) {
            if (
$url->getHost() !== $this->urlToBeCrawled->getHost()) {
                return 
false;
            }

            if (! 
is_callable($this->shouldCrawl)) {
                return 
true;
            }

            return (
$this->shouldCrawl)($url);
        };

        
$profileClass config('sitemap.crawl_profile'Profile::class);
        
$profile = new $profileClass($this->urlToBeCrawled);

        if (
method_exists($profile'shouldCrawlCallback')) {
            
$profile->shouldCrawlCallback($shouldCrawl);
        }

        return 
$profile;
    }

    protected function 
getCrawlObserver(): Observer
    
{
        
$performAfterUrlHasBeenCrawled = function (UriInterface $crawlerUrlResponseInterface $response null) {
            
$sitemapUrl = ($this->hasCrawled)(Url::create((string) $crawlerUrl), $response);

            if (
$this->shouldStartNewSitemapFile()) {
                
$this->sitemaps->push(new Sitemap);
            }

            if (
$sitemapUrl) {
                
$this->sitemaps->last()->add($sitemapUrl);
            }
        };

        return new 
Observer($performAfterUrlHasBeenCrawled);
    }

    protected function 
shouldStartNewSitemapFile(): bool
    
{
        if (! 
$this->maximumTagsPerSitemap) {
            return 
false;
        }

        
$currentNumberOfTags count($this->sitemaps->last()->getTags());

        return 
$currentNumberOfTags >= $this->maximumTagsPerSitemap;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0037 ]--