| Server IP : 89.108.64.180 / Your IP : 216.73.217.95 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/hotelgerda.ru/wp-content/plugins/mphb-invoices/classes/ |
Upload File : |
<?php
namespace MPHB\Addons\Invoice;
class Plugin
{
/** @var self */
protected static $instance = null;
// Single components
/** @var \MPHB\Addons\Invoice\Admin\SettingsTab */
protected $settingsTab = null;
/** @var \MPHB\Addons\Invoice\Update\PluginUpdater */
protected $pluginUpdater = null;
/** @var \MPHB\Addons\Invoice\PDF\PDFHelper */
protected $pdf = null;
/** @var \MPHB\Addons\Invoice\Email\TagsProcessor */
protected $emailTags = null;
// Containers
/** @var \MPHB\Addons\Invoice\Containers\ApisContainer */
protected $apisContainer = null;
/** @var \MPHB\Addons\Invoice\Containers\ApisContainer */
// Other fields
protected $pluginHeaders = [];
public function __construct()
{
add_action('plugins_loaded', [$this, 'load']);
add_action('init', [$this, 'init']);
$this->emailTags = new Email\TagsProcessor();
}
public function load()
{
if (!class_exists('HotelBookingPlugin')) {
return;
}
$this->apisContainer = new Containers\ApisContainer();
$this->pdf = new PDF\PDFHelper();
add_action('init', [$this, 'loadTranslations']);
if (wp_doing_ajax()) {
} else {
$this->settingsTab = new Admin\SettingsTab();
$this->pluginUpdater = new Update\PluginUpdater();
}
}
public function init()
{
if (!class_exists('HotelBookingPlugin')) {
return;
}
}
public function loadTranslations()
{
$pluginDir = plugin_basename(PLUGIN_DIR); // "mphb-invoices" or renamed name
load_plugin_textdomain('mphb-invoices', false, $pluginDir . '/languages');
}
/**
* @return \MPHB\Addons\Invoice\Containers\ApisContainer
*/
public function api()
{
return $this->apisContainer;
}
/**
* @return \MPHB\Addons\Invoice\PDF\PDFHelper
*/
public function pdf()
{
return $this->pdf;
}
/**
* @return string
*/
public function pluginUri()
{
$headers = $this->pluginHeaders();
return $headers['PluginURI'];
}
/**
* @return string
*/
public function pluginVersion()
{
$headers = $this->pluginHeaders();
return $headers['Version'];
}
/**
* @return string
*/
public function pluginAuthor()
{
$headers = $this->pluginHeaders();
return $headers['Author'];
}
/**
* @return string[]
*/
public function pluginHeaders()
{
if (empty($this->pluginHeaders)) {
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$headers = get_plugin_data(PLUGIN_FILE, false, false);
$headers = array_merge([
'PluginURI' => 'https://motopress.com/products/hotel-booking-invoices/',
'Version' => '1.0',
'Author' => 'MotoPress'
], $headers);
$this->pluginHeaders = $headers;
}
return $this->pluginHeaders;
}
/**
* @return static
*/
public static function getInstance()
{
if (is_null(static::$instance)) {
static::$instance = new static();
}
return static::$instance;
}
}