| 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 : |
<?php
namespace MPHB\Addons\RequestPayment;
use MPHB\Addons\RequestPayment\Utils\BookingUtils;
class Assets
{
protected $isDebug = false;
public function __construct()
{
$this->isDebug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG);
add_action('wp_enqueue_scripts', array($this, 'register'));
add_action('admin_enqueue_scripts', array($this, 'register'));
}
public function register()
{
$frontScriptDependencies = array('mphb', 'mphb-jquery-serialize-json');
if (MPHB()->gatewayManager()->getGateway('stripe')->isActive()) {
$frontScriptDependencies[] = 'mphb-vendor-stripe-library';
}
if (MPHB()->gatewayManager()->getGateway('braintree')->isActive()) {
$frontScriptDependencies[] = 'mphb-vendor-braintree-client-sdk';
}
wp_register_script('mphbrp-front', $this->scriptUrl('assets/scripts/frontend.min.js'), $frontScriptDependencies, MPHBRP()->getVersion(), true);
}
public function enqueueFront()
{
wp_enqueue_script('mphbrp-front');
}
public function enqueueAdmin()
{
}
public function addCheckoutData($booking)
{
$toPay = BookingUtils::getToPayPrice($booking);
// Add price
MPHB()->getPublicScriptManager()->addCheckoutData(array('total' => $toPay));
// Add gateways
foreach (MPHB()->gatewayManager()->getListActive() as $gateway) {
$checkoutData = $gateway->getCheckoutData($booking);
// Don't use the deposit amount for requests, use the real "to pay"
// price instead
$checkoutData['amount'] = $toPay;
MPHB()->getPublicScriptManager()->addGatewayData($gateway->getId(), $checkoutData);
}
}
protected function scriptUrl($relativePath)
{
if ($this->isDebug) {
$relativePath = str_replace(array('.min.js', '.min.css'), array('.js', '.css'), $relativePath);
}
return MPHBRP()->urlTo($relativePath);
}
}