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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/spatie/laravel-analytics/src/   drwxr-xr-x
Free 13.12 GB of 57.97 GB (22.64%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Spatie\Analytics;

use 
Carbon\Carbon;
use 
Google_Service_Analytics;
use 
Illuminate\Support\Collection;
use 
Illuminate\Support\Traits\Macroable;

class 
Analytics
{
    use 
Macroable;

    
/** @var \Spatie\Analytics\AnalyticsClient */
    
protected $client;

    
/** @var string */
    
protected $viewId;

    
/**
     * @param \Spatie\Analytics\AnalyticsClient $client
     * @param string                            $viewId
     */
    
public function __construct(AnalyticsClient $clientstring $viewId)
    {
        
$this->client $client;

        
$this->viewId $viewId;
    }

    
/**
     * @param string $viewId
     *
     * @return $this
     */
    
public function setViewId(string $viewId)
    {
        
$this->viewId $viewId;

        return 
$this;
    }

    public function 
getViewId()
    {
        return 
$this->viewId;
    }

    public function 
fetchVisitorsAndPageViews(Period $period): Collection
    
{
        
$response $this->performQuery(
            
$period,
            
'ga:users,ga:pageviews',
            [
'dimensions' => 'ga:date,ga:pageTitle']
        );

        return 
collect($response['rows'] ?? [])->map(function (array $dateRow) {
            return [
                
'date' => Carbon::createFromFormat('Ymd'$dateRow[0]),
                
'pageTitle' => $dateRow[1],
                
'visitors' => (int) $dateRow[2],
                
'pageViews' => (int) $dateRow[3],
            ];
        });
    }

    public function 
fetchTotalVisitorsAndPageViews(Period $period): Collection
    
{
        
$response $this->performQuery(
            
$period,
            
'ga:users,ga:pageviews',
            [
'dimensions' => 'ga:date']
        );

        return 
collect($response['rows'] ?? [])->map(function (array $dateRow) {
            return [
                
'date' => Carbon::createFromFormat('Ymd'$dateRow[0]),
                
'visitors' => (int) $dateRow[1],
                
'pageViews' => (int) $dateRow[2],
            ];
        });
    }

    public function 
fetchMostVisitedPages(Period $periodint $maxResults 20): Collection
    
{
        
$response $this->performQuery(
            
$period,
            
'ga:pageviews',
            [
                
'dimensions' => 'ga:pagePath,ga:pageTitle',
                
'sort' => '-ga:pageviews',
                
'max-results' => $maxResults,
            ]
        );

        return 
collect($response['rows'] ?? [])
            ->
map(function (array $pageRow) {
                return [
                    
'url' => $pageRow[0],
                    
'pageTitle' => $pageRow[1],
                    
'pageViews' => (int) $pageRow[2],
                ];
            });
    }

    public function 
fetchTopReferrers(Period $periodint $maxResults 20): Collection
    
{
        
$response $this->performQuery(
            
$period,
            
'ga:pageviews',
            [
                
'dimensions' => 'ga:fullReferrer',
                
'sort' => '-ga:pageviews',
                
'max-results' => $maxResults,
            ]
        );

        return 
collect($response['rows'] ?? [])->map(function (array $pageRow) {
            return [
                
'url' => $pageRow[0],
                
'pageViews' => (int) $pageRow[1],
            ];
        });
    }

    public function 
fetchUserTypes(Period $period): Collection
    
{
        
$response $this->performQuery(
            
$period,
            
'ga:sessions',
            [
                
'dimensions' => 'ga:userType',
            ]
        );

        return 
collect($response->rows ?? [])->map(function (array $userRow) {
            return [
                
'type' => $userRow[0],
                
'sessions' => (int) $userRow[1],
            ];
        });
    }

    public function 
fetchTopBrowsers(Period $periodint $maxResults 10): Collection
    
{
        
$response $this->performQuery(
            
$period,
            
'ga:sessions',
            [
                
'dimensions' => 'ga:browser',
                
'sort' => '-ga:sessions',
            ]
        );

        
$topBrowsers collect($response['rows'] ?? [])->map(function (array $browserRow) {
            return [
                
'browser' => $browserRow[0],
                
'sessions' => (int) $browserRow[1],
            ];
        });

        if (
$topBrowsers->count() <= $maxResults) {
            return 
$topBrowsers;
        }

        return 
$this->summarizeTopBrowsers($topBrowsers$maxResults);
    }

    protected function 
summarizeTopBrowsers(Collection $topBrowsersint $maxResults): Collection
    
{
        return 
$topBrowsers
            
->take($maxResults 1)
            ->
push([
                
'browser' => 'Others',
                
'sessions' => $topBrowsers->splice($maxResults 1)->sum('sessions'),
            ]);
    }

    
/**
     * Call the query method on the authenticated client.
     *
     * @param Period $period
     * @param string $metrics
     * @param array  $others
     *
     * @return array|null
     */
    
public function performQuery(Period $periodstring $metrics, array $others = [])
    {
        return 
$this->client->performQuery(
            
$this->viewId,
            
$period->startDate,
            
$period->endDate,
            
$metrics,
            
$others
        
);
    }

    
/*
     * Get the underlying Google_Service_Analytics object. You can use this
     * to basically call anything on the Google Analytics API.
     */
    
public function getAnalyticsService(): Google_Service_Analytics
    
{
        return 
$this->client->getAnalyticsService();
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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