Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/resources/agGrid/Decorators.tar
Назад
BrowserDecorator.php 0000755 00000002126 15111603245 0010545 0 ustar 00 <?php namespace WP_Statistics\Decorators; use WP_Statistics\Service\Analytics\DeviceDetection\DeviceHelper; use WP_STATISTICS\Helper; class BrowserDecorator { private $visitor; public function __construct($visitor) { $this->visitor = $visitor; } /** * Returns the raw agent value. * * @return string */ public function getRaw() { return \WP_STATISTICS\Admin_Template::unknownToNotSet($this->visitor->agent) ?? null; } /** * Get the browser name. * * @return string */ public function getName() { return \WP_STATISTICS\Admin_Template::unknownToNotSet($this->visitor->agent); } /** * Get the browser logo URL. * * @return string */ public function getLogo() { return DeviceHelper::getBrowserLogo($this->visitor->agent); } /** * Get the browser version used by the visitor. * * @return string|null */ public function getVersion() { return Helper::getMajorVersionOnly($this->visitor->version) ?? null; } } DeviceDecorator.php 0000755 00000002101 15111603245 0010312 0 ustar 00 <?php namespace WP_Statistics\Decorators; use WP_Statistics\Service\Analytics\DeviceDetection\DeviceHelper; use WP_STATISTICS\Admin_Template; class DeviceDecorator { private $visitor; public function __construct($visitor) { $this->visitor = $visitor; } /** * Get the device type (e.g., smartphone, desktop) used by the visitor. * * @return string|null */ public function getType() { $device = $this->visitor->device ? ucfirst($this->visitor->device) : null; return \WP_STATISTICS\Admin_Template::unknownToNotSet($device); } /** * Get the device model (e.g., iPhone, Galaxy S10) used by the visitor. * * @return string|null */ public function getModel() { return \WP_STATISTICS\Admin_Template::unknownToNotSet($this->visitor->model); } /** * Get the device logo URL based on the visitor's platform. * * @return string */ public function getLogo() { return DeviceHelper::getDeviceLogo($this->visitor->device ?? ''); } } EventDecorator.php 0000755 00000002135 15111603245 0010203 0 ustar 00 <?php namespace WP_Statistics\Decorators; use WP_Statistics\Components\DateTime; use WP_Statistics\Decorators\ResourceDecorator; use WP_Statistics\Decorators\UserDecorator; use WP_Statistics\Models\VisitorsModel; class EventDecorator { protected $event; protected $eventData; public function __construct($event) { $this->event = $event; $this->eventData = json_decode($this->event->event_data, true); } public function getDate() { return DateTime::format($this->event->date, ['include_time' => true]); } public function getName() { return $this->event->event_name; } public function getData() { return $this->eventData; } public function getPage() { return new ResourceDecorator($this->event->page_id); } public function getUser() { return new UserDecorator($this->event->user_id); } public function getVisitor() { $visitorsModel = new VisitorsModel(); return $visitorsModel->getVisitorData(['visitor_id' => $this->event->visitor_id]); } } LocationDecorator.php 0000755 00000003167 15111603245 0010700 0 ustar 00 <?php namespace WP_Statistics\Decorators; use WP_STATISTICS\Country; class LocationDecorator { private $visitor; public function __construct($visitor) { $this->visitor = $visitor; } /** * Get the country icon URL based on the visitor's location. * * @return string */ public function getCountryFlag() { return Country::flag($this->visitor->location); } /** * Get the country name based on the visitor's location. * * @return string */ public function getCountryName() { return Country::getName($this->visitor->location); } /** * Retrieves the country code of the visitor. * * @return string The country code, or unknown if not available. */ public function getCountryCode() { return $this->visitor->location ?? Country::$unknown_location; } /** * Retrieves the region of the visitor. * * @return string|null The region of the visitor, or null if not available. */ public function getRegion() { return $this->visitor->region ?? null; } /** * Retrieves the city associated with the visitor's location. * * @return string|null The city name, or null if not available. */ public function getCity() { return $this->visitor->city ?? null; } /** * Retrieves the continent associated with the visitor's location. * * @return string|null The continent name, or null if not available. */ public function getContinent() { return $this->visitor->continent ?? null; } } MarketingCampaignDecorator.php 0000755 00000006017 15111603245 0012506 0 ustar 00 <?php namespace WP_Statistics\Decorators; class MarketingCampaignDecorator { /** * @var mixed The marketing campaign object being decorated. */ private $marketingCampaign; /** * MarketingCampaignDecorator constructor. * * @param mixed $marketingCampaign The marketing campaign object. */ public function __construct($marketingCampaign) { $this->marketingCampaign = $marketingCampaign; } /** * Get the marketing campaign ID. * * @return int|null The ID of the marketing campaign or null if not set. */ public function getId() { return $this->marketingCampaign->id ?? null; } /** * Get the marketing campaign URL. * * @return string|null. */ public function getUrl() { return $this->marketingCampaign->data['url'] ?? null; } /** * Get the marketing campaign icon. * * @return string|null */ public function getIcon() { return json_decode($this->marketingCampaign->data['icon']) ?? null; } /** * Get the marketing campaign title. * * @return string|null */ public function getTitle() { return $this->marketingCampaign->data['title'] ?? null; } /** * Get the marketing campaign tooltip. * * @return string|null */ public function getTooltip() { return $this->marketingCampaign->data['tooltip'] ?? null; } /** * Get the marketing campaign activated at. * * @return string|null */ public function getActivatedAt() { return $this->marketingCampaign->activated_at ?? null; } /** * Get the marketing campaign expires at. * * @return string|null */ public function getExpiresAt() { return $this->marketingCampaign->expires_at ?? null; } /** * Get the background color of the marketing campaign. * * @return string|null */ public function getBackgroundColor() { $backgroundColors = [ 'inherit' => '', 'danger' => 'wps-marketing-campaign__danger', 'info' => 'wps-marketing-campaign__info', 'warning' => 'wps-marketing-campaign__warning', 'success' => 'wps-marketing-campaign__success' ]; return $backgroundColors[$this->marketingCampaign->data['background_color']] ?? null; } /** * Get the text color of the marketing campaign. * * @return string|null */ public function getTextColor() { $textColor = [ 'inherit' => '', 'dark' => 'wps-marketing-campaign-text__dark', 'light' => 'wps-marketing-campaign-text__light', ]; return $textColor[$this->marketingCampaign->data['text_color']] ?? null; } /** * Get the type of the marketing campaign. * * @return string|null */ public function getType() { return $this->marketingCampaign->type ?? null; } } NotificationDecorator.php 0000755 00000010132 15111603245 0011544 0 ustar 00 <?php namespace WP_Statistics\Decorators; class NotificationDecorator { /** * @var mixed The notification object being decorated. */ private $notification; /** * NotificationDecorator constructor. * * @param mixed $notification The notification object. */ public function __construct($notification) { $this->notification = $notification; } /** * Get the notification ID. * * @return int|null The ID of the notification or null if not set. */ public function getID() { return $this->notification->id ?? null; } /** * Get the notification title. * * @return string|null The title of the notification or null if not set. */ public function getTitle() { return $this->notification->title ?? null; } /** * Get the notification icon. * * @return string|null The icon URL or null if not set. */ public function getIcon() { return json_decode($this->notification->icon) ?? null; } /** * Get the notification description. * * @return string|null The description of the notification or null if not set. */ public function getDescription() { return json_decode($this->notification->description) ?? null; } /** * Get the primary button title. * * @return string|null The title of the primary button or null if not set. */ public function primaryButtonTitle() { return $this->notification->primary_button['title'] ?? null; } /** * Get the primary button URL. * * @return string|null The URL of the primary button or null if not set. */ public function primaryButtonUrl() { $homeUrl = home_url(); $url = isset($this->notification->primary_button['url']) ? str_replace('{baseUrl}', $homeUrl, $this->notification->primary_button['url']) : null; return $url; } /** * Get the secondary button title. * * @return string|null The title of the secondary button or null if not set. */ public function secondaryButtonTitle() { return $this->notification->secondary_button['title'] ?? null; } /** * Get the secondary button URL. * * @return string|null The URL of the secondary button or null if not set. */ public function secondaryButtonUrl() { $homeUrl = home_url(); $url = isset($this->notification->secondary_button['url']) ? str_replace('{baseUrl}', $homeUrl, $this->notification->secondary_button['url']) : null; return $url; } /** * Get the background color of the notification. * * @return string|null The background color in hex format or null if not set. */ public function backgroundColor() { $backgroundColors = [ 'inherit' => '', 'danger' => 'wps-notification-sidebar__danger', 'info' => 'wps-notification-sidebar__info', 'warning' => 'wps-notification-sidebar__warning', 'success' => 'wps-notification-sidebar__success' ]; return $backgroundColors[$this->notification->background_color] ?? null; } /** * Get the activation timestamp of the notification. * * @return string|null The activation timestamp or null if not set. */ public function activatedAt() { if ($this->notification->activated_at) { $timezoneOffset = get_option('gmt_offset') * 3600; $timestamp = strtotime($this->notification->activated_at); $timestamp += $timezoneOffset; $timeDiff = human_time_diff($timestamp, current_time('timestamp')); return $timeDiff . ' ' . __('ago', 'wp-statistics'); } return null; } /** * Get the dismiss status or value of the notification. * * @return mixed|null The dismiss value if set, otherwise null. */ public function getDismiss() { return $this->notification->dismiss ?? null; } } OsDecorator.php 0000755 00000001275 15111603245 0007507 0 ustar 00 <?php namespace WP_Statistics\Decorators; use WP_Statistics\Service\Analytics\DeviceDetection\DeviceHelper; class OsDecorator { private $visitor; public function __construct($visitor) { $this->visitor = $visitor; } /** * Get the operating system name * * @return string */ public function getName() { return \WP_STATISTICS\Admin_Template::unknownToNotSet($this->visitor->platform) ?? null; } /** * Get the operating system logo URL based on the visitor's platform. * * @return string */ public function getLogo() { return DeviceHelper::getPlatformLogo($this->visitor->platform); } } ReferralDecorator.php 0000755 00000003534 15111603245 0010670 0 ustar 00 <?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); } } ResourceDecorator.php 0000755 00000001013 15111603245 0010703 0 ustar 00 <?php namespace WP_Statistics\Decorators; class ResourceDecorator { private $postId; public function __construct($postId) { $this->postId = $postId; } public function getId() { return $this->postId; } public function getTitle() { return get_the_title($this->postId); } public function getUrl() { return get_the_permalink($this->postId); } public function getPostType() { return get_post_type($this->postId); } } UserDecorator.php 0000755 00000004055 15111603245 0010043 0 ustar 00 <?php namespace WP_Statistics\Decorators; use WP_STATISTICS\Helper; use WP_STATISTICS\User; use WP_User; class UserDecorator { private $user; public function __construct($userId) { $this->user = get_user_by('id', $userId); } /** * Check if the user exists in the database. * * @return bool */ public function exists() { return $this->user instanceof WP_User; } /** * Get the visitor's user ID (if logged in). * * @return int|null */ public function getId() { return $this->user->ID ?? null; } /** * Retrieves the display name of the visitor. * * @return string|null The name of the visitor, or null if not available. */ public function getDisplayName() { return $this->user->display_name ?? null; } /** * Retrieves the email address of the visitor if they are a logged-in user. * * @return string|null The visitor's email address, or null if not available. */ public function getEmail() { return $this->user->user_email ?? null; } /** * Retrieves the first role of the visitor. * * @return string|null The visitor's first role, or null if not available. */ public function getRole() { return $this->user->roles[0] ?? null; } /** * Retrieves the registered date of the visitor. * * @return string|null The visitor's registered date, or null if not available. */ public function getRegisteredDate() { return $this->user->user_registered ? date_i18n(Helper::getDefaultDateFormat(true), strtotime($this->user->user_registered)) : null; } /** * Retrieves the last login date of the visitor. * * @return string|null The visitor's last login date, or null if not available. */ public function getLastLogin() { $lastLogin = User::getLastLogin($this->getId()); return $lastLogin ? date_i18n(Helper::getDefaultDateFormat(true), $lastLogin) : null; } } VisitorDecorator.php 0000755 00000015152 15111603245 0010564 0 ustar 00 <?php namespace WP_Statistics\Decorators; use WP_STATISTICS\IP; use WP_STATISTICS\Helper; use WP_STATISTICS\Option; use WP_STATISTICS\Visitor; use WP_Statistics\Components\DateTime; class VisitorDecorator { /** * @var mixed */ private $visitor; /** * VisitorDecorator constructor. * @param mixed $visitor */ public function __construct($visitor) { $this->visitor = $visitor; } /** * Get the visitor's ID. * * @return int|null */ public function getId() { return $this->visitor->ID ?? null; } /** * Returns the visitor's location. * * @return LocationDecorator */ public function getLocation() { return new LocationDecorator($this->visitor); } /** * Get the visitor's browser. * * @return BrowserDecorator */ public function getBrowser() { return new BrowserDecorator($this->visitor); } /** * Get the platform (operating system) * * @return OsDecorator */ public function getOs() { return new OsDecorator($this->visitor); } /** * Get the device used by the visitor. * * @return DeviceDecorator */ public function getDevice() { return new DeviceDecorator($this->visitor); } /** * Get the visitor's user agent string. * * @return string|null */ public function getUserAgent() { return $this->visitor->UAString ?? null; } /** * Get the visitor's IP address. * * @return string|null */ public function getIP() { return $this->isHashedIP() ? '#' . substr($this->visitor->ip, 6, 8) : $this->visitor->ip; } /** * Returns the raw IP address of the visitor. * * @return string The raw IP address of the visitor. */ public function getRawIP() { return $this->visitor->ip; } /** * Is the visitor's IP hashed? * * @return string|null */ public function isHashedIP() { return IP::IsHashIP($this->visitor->ip); } /** * Checks if the visitor's IP address is anonymized. * * @return bool True if the IP address is anonymized, false otherwise. */ public function isIpAnonymized() { return IP::isIpAnonymized($this->visitor->ip); } /** * Checks if the visitor is anonymous. * * @return bool */ public function isAnonymous() { return empty($this->getUser()) && ($this->isHashedIP() || $this->isIpAnonymized()); } /** * Get the number of hits the visitor has made. * * @return int|null */ public function getHits() { return $this->visitor->hits ? number_format_i18n(intval($this->visitor->hits)) : 0; } /** * Get the last counter value recorded for the visitor. * * @return int|null */ public function getLastCounter() { return !empty($this->visitor->last_counter) ? DateTime::format($this->visitor->last_counter, [ 'include_time' => true, 'exclude_year' => true, 'separator' => ', ' ]) : null; } /** * Get the visitor's referral information. * * @return ReferralDecorator */ public function getReferral() { return new ReferralDecorator($this->visitor); } /** * Checks whether the visitor is a logged-in user. * * @return bool True if the visitor is logged in, false otherwise. */ public function isLoggedInUser() { return $this->getUser() !== null; } /** * Get the visitor's user object (if logged in). * * @return UserDecorator */ public function getUser() { if ($this->getUserId()) { $user = new UserDecorator($this->getUserId()); if ($user->exists()) { return $user; } } return null; } /** * Get user ID * * @return mixed */ public function getUserId() { return $this->visitor->user_id; } /** * Retrieves the first view time of the visitor. * * @return int|null The time of the first view, or null if not available. */ public function getFirstView() { return !empty($this->visitor->first_view) ? DateTime::format($this->visitor->first_view, [ 'include_time' => true, 'exclude_year' => true, 'separator' => ', ' ]) : null; } /** * Retrieves the first page viewed by the visitor. * * @return string|null The first page viewed by the visitor, or null if not available. */ public function getFirstPage() { return !empty($this->visitor->first_page) ? Visitor::get_page_by_id($this->visitor->first_page) : null; } /** * Retrieves the last view time of the visitor. * * @param bool $raw Whether return raw value or formatted. * @return string The time of the last view, or null if not available. */ public function getLastView($raw = false) { // Get date from last_view (DateTime), if not set use last_counter (Date) $date = $this->visitor->last_view ?? $this->visitor->last_counter; if ($raw) { return $date; } $date = date_i18n(Helper::getDefaultDateFormat(true, true, false, ', '), strtotime($date)); return $date ?? null; } /** * Retrieves the last page viewed by the visitor. * * @return string|null The last page viewed by the visitor, or null if not available. */ public function getLastPage() { return $this->visitor->last_page ? Visitor::get_page_by_id($this->visitor->last_page) : null; } /** * Retrieves the date a certain page has been viewed * * @return string|null The last page viewed by the visitor, or null if not available. */ public function getPageView() { return !empty($this->visitor->page_view) ? DateTime::format($this->visitor->page_view, [ 'include_time' => true, 'exclude_year' => true, 'separator' => ', ' ]) : null; } /** * Retrieves the online time of the visitor. * * @return string|null The online time in 'H:i:s' format, or null if not available. */ public function getOnlineTime() { if (isset($this->visitor->timestamp) && isset($this->visitor->created)) { return date_i18n('H:i:s', $this->visitor->timestamp - $this->visitor->created); } return null; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка