403Webshell
Server IP : 89.108.64.180  /  Your IP : 216.73.216.60
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-request-payment/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/hotelgerda.ru/wp-content/plugins/mphb-request-payment/classes/Plugin.php
<?php

namespace MPHB\Addons\RequestPayment;

use MPHB\Addons\RequestPayment\Crons\RequestPaymentsCron;
use MPHB\Addons\RequestPayment\Emails\NewTags;
use MPHB\Addons\RequestPayment\Listeners\PostUpdateListener;
use MPHB\Addons\RequestPayment\Listeners\TransitionsListener;
use MPHB\Addons\RequestPayment\MetaBoxes\RequestPaymentMetaBox;
use MPHB\Addons\RequestPayment\Shortcodes\CheckoutShortcode;
use MPHB\Addons\RequestPayment\Utils\EmailUtils;
use MPHB\Addons\RequestPayment\Utils\SettingsTabUtils;
use MPHB\Addons\RequestPayment\Utils\TemplateUtils;

final class Plugin
{
    /** @var Plugin */
    private static $instance = null;

    /** @var Ajax */
    private $ajax = null;

    /** @var Assets */
    private $assets = null;

    /** @var RequestPaymentsCron */
    private $cron = null;

    /** @var NewTags */
    private $tags = null;

    /** @var CheckoutShortcode */
    private $shortcode = null;

    /** @var string[] */
    private $pluginHeaders = array();

    private function __construct()
    {
        // Emails are inited on priority 10; run earlier to add our emails
        add_action('plugins_loaded', array($this, 'onLoad'), 9);
    }

    public function onLoad()
    {
        if (!class_exists('HotelBookingPlugin')) {
            return;
        }

        // Load translations
        add_action('init', array($this, 'loadTranslations'));

        if ($this->isAjax()) {
            $this->ajaxLoad();
        } else {
            $this->regularLoad();
        }
    }

    private function ajaxLoad()
    {
        $this->ajax = new Ajax();

        // Add +1 handler of action "get_billing_fields"
        $this->ajax->redefineActions();
    }

    private function regularLoad()
    {
        $this->assets = new Assets();
        $this->shortcode = new CheckoutShortcode();

        // Run configurator
        new Configurator();

        // Run auto-updater
        new Updater();

        // Run transitions listener and post update listener
        new TransitionsListener();
        new PostUpdateListener();

        // Add cron to request payments automatically
        $this->cron = new RequestPaymentsCron('request_payments', 'twicedaily');
        $this->cron->schedule(); // Always run and check bookings

        MPHB()->cronManager()->addCron($this->cron);

        // Register new emails
        $this->tags = new NewTags();

        EmailUtils::addRequestPaymentEmail();
        EmailUtils::addRequestPaidEmail();

        // Add more templates and register settings tab
        TemplateUtils::addCustomTemplatesPath();
        SettingsTabUtils::addSettingsTab();

        // Register Request Payment meta box for Edit Booking page
        new RequestPaymentMetaBox('request_payment_link', esc_html__('Payment Request', 'mphb-request-payment'),
            MPHB()->postTypes()->booking()->getPostType(), 'side');
    }

    /**
     * @return Assets
     */
    public function assets()
    {
        return $this->assets;
    }

    /**
     * @return NewTags
     */
    public function tags()
    {
        return $this->tags;
    }

    /**
     * @return CheckoutShortcode
     */
    public function checkoutShortcode()
    {
        return $this->shortcode;
    }

    public function getVersion()
    {
        $headers = $this->getPluginHeaders();
        return $headers['Version'];
    }

    public function getAuthor()
    {
        $headers = $this->getPluginHeaders();
        return $headers['Author'];
    }

    public function getPluginUri()
    {
        $headers = $this->getPluginHeaders();
        return $headers['PluginURI'];
    }

    public function getPluginFile()
    {
        return $this->pathTo(SLUG . '.php');
    }

    public function getPluginHeaders()
    {
        if (empty($this->pluginHeaders)) {
            if (!function_exists('get_plugin_data')) {
                require_once ABSPATH . 'wp-admin/includes/plugin.php';
            }

            $pluginFile = $this->getPluginFile();

            $headers = get_plugin_data($pluginFile, false, false);
            $headers = array_merge(array(
                'Version'   => '1.0',
                'Author'    => 'MotoPress',
                'PluginURI' => 'https://motopress.com/products/hotel-booking-payment-request/'
            ), $headers);

            $this->pluginHeaders = $headers;
        }

        return $this->pluginHeaders;
    }

    public function isAjax()
    {
        return defined('DOING_AJAX') && DOING_AJAX;
    }

    public function pathTo($relativePath)
    {
        return ROOT . $relativePath;
    }

    public function urlTo($relativePath)
    {
        return ROOT_URL . $relativePath;
    }

    public function loadTranslations()
    {
        load_plugin_textdomain('mphb-request-payment', false, SLUG . '/languages');
    }

    public function onActivate()
    {
        global $wpdb;

        // Add options to autoload set
        $wpdb->query("UPDATE {$wpdb->options} SET autoload = 'yes' WHERE option_name IN ('mphbrp_configured', 'mphbrp_license_key')");

        // Save latest booking ID (activation hook works before "plugins_loaded",
        // so the cron class will have the proper ID)
        $latestBookingId = get_option('mphbrp_last_skipped_booking_id', -1);

        if ($latestBookingId == -1) {
            $latestBookings = get_posts(array(
                'post_type'      => 'mphb_booking',
                'post_status'    => 'any',
                'posts_per_page' => 1,
                'orderby'        => 'ID',
                'order'          => 'DESC'
            ));

            if (!empty($latestBookings)) {
                $latestBooking = reset($latestBookings);
                $latestBookingId = $latestBooking->ID;
            } else {
                $latestBookingId = 0;
            }

            update_option('mphbrp_last_skipped_booking_id', $latestBookingId, 'no');
        }
    }

    public function onDeactivate()
    {
        global $wpdb;

        // Remove options from autoload set
        $wpdb->query("UPDATE {$wpdb->options} SET autoload = 'no' WHERE option_name LIKE 'mphbrp_%'");

        // Don't leave the running crons
        $this->cron->unschedule();
    }

    public static function getInstance()
    {
        if (is_null(static::$instance)) {
            static::$instance = new self();
        }

        return static::$instance;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit