Uname: Linux premium72.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.2.29 [ PHP INFO ] PHP os: Linux
Server Ip: 198.54.125.95
Your Ip: 216.73.216.164
User: matican (532) | Group: matican (531)
Safe Mode: OFF
Disable Function:
NONE

name : Widget.php
<?php

/**
 * @copyright Copyright (c) 2009-2022 ThemeCatcher (https://www.themecatcher.net)
 */
class Quform_Dashboard_Widget
{
    /**
     * @var Quform_Repository
     */
    protected $repository;

    /**
     * @var Quform_ViewFactory
     */
    protected $viewFactory;

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

    /**
     * @var Quform_Options
     */
    protected $options;

    /**
     * @param Quform_Repository  $repository
     * @param Quform_ViewFactory $viewFactory
     * @param Quform_Options     $options
     */
    public function __construct(Quform_Repository $repository, Quform_ViewFactory $viewFactory, Quform_Options $options)
    {
        $this->repository = $repository;
        $this->viewFactory = $viewFactory;
        $this->options = $options;
        $this->template = QUFORM_TEMPLATE_PATH . '/admin/dashboard-widget.php';
    }

    public function setup()
    {
        if (
            ! $this->options->get('dashboardWidget') ||
            ! current_user_can('quform_view_entries') ||
            ! $this->repository->getAllUnreadEntriesCount() > 0
        ) {
            // The widget is turned off, user doesn't have permission to view entries or there are no unread entries
            return;
        }

        wp_enqueue_style('qfb-dashboard', Quform::adminUrl('css/dashboard.min.css'), array(), QUFORM_VERSION);
        wp_add_dashboard_widget('qfb-dashboard-widget', Quform::getPluginName(), array($this, 'display'));
    }

    public function display()
    {
        $data = array(
            'forms' => $this->repository->getAllFormsWithUnreadEntries()
        );

        echo $this->viewFactory->create($this->template, $data)->render();
    }
}
© 2025 XylotrechusZ