403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.3/wp-content/plugins/wp-statistics/src/Decorators/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.3/wp-content/plugins/wp-statistics/src/Decorators/NotificationDecorator.php
<?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;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit