Server : LiteSpeed
System : Linux quebec.us.hostns.io 5.14.0-687.42.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 27 11:55:12 EDT 2026 x86_64
User : gazetufm ( 1431)
PHP Version : 8.1.35
Disable Function : NONE
Directory :  /home2/gazetufm/dumoshi.com/wp-content/plugins/wp-statistics/src/Decorators/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: ReferralDecorator.php

Path: //home2/gazetufm/dumoshi.com/wp-content/plugins/wp-statistics/src/Decorators/ReferralDecorator.php

Size: 1.84 KB

Permissions: 0644

<?php

namespace WP_Statistics\Decorators;

use WP_Statistics\Service\Analytics\Referrals\SourceChannels;
use WP_Statistics\Utils\Url;

class ReferralDecorator
{
    private $item;

    public function __construct($item)
    {
        $this->item = $item;
    }

    /**
     * Get the raw referrer value.
     *
     * @return string|null
     */
    public function getRawReferrer()
    {
        return $this->item->referred ?? null;
    }

    /**
     * Get the referrer url.
     *
     * @return string|null
     */
    public function getReferrer()
    {
        return $this->item->referred ? Url::formatUrl($this->item->referred) : null;
    }

    /**
     * Get the source channel name (e.g., Direct, Organic Search, etc.).
     *
     * @return string|null
     */
    public function getSourceChannel()
    {
        return SourceChannels::getName($this->getRawSourceChannel());
    }

    /**
     * Get the raw source channel value (e.g., direct, search, etc.).
     *
     * @return string|null
     */
    public function getRawSourceChannel()
    {
        return $this->item->source_channel ?? 'unassigned';
    }

    /**
     * Get the source name (e.g., Google, Yandex, etc.).
     *
     * @return string|null
     */
    public function getSourceName()
    {
        return $this->item->source_name ?? null;
    }

    /**
     * Get the date of the referral.
     *
     * @return string
     */
    public function getDate()
    {
        return $this->item->last_counter ?? null;
    }

    /**
     * Get the total number of referrals.
     *
     * @param bool $raw Whether return raw value or formatted.
     * @return int|string
     */
    public function getTotalReferrals($raw = false)
    {
        if (empty($this->item->visitors)) return 0;

        return $raw ? intval($this->item->visitors) : number_format_i18n($this->item->visitors);
    }
}

← Back to Directory Edit File 🔒 Chmod

WP File Manager