public static function getInstance(modX $modx) { self::$modx = $modx; if (isset(self::$instance) && self::$instance instanceof payqr_status) { return self::$instance; } else { self::$instance = new self(); } return self::$instance; }
<?php if (isset($config, $config['status_cancelled'])) { $order_id = $Payqr->objectOrder->getOrderId(); if (empty($order_id)) { return false; } $status_cancelled = payqr_status::getInstance($modx)->getStatusId($config['status_cancelled']); if (empty($status_cancelled)) { return false; } $payqrOrder = new payqr_order($modx, $Payqr); $payqrOrder->changeStatus($order_id, $status_cancelled); }
<?php if (isset($config, $config['status_paid'])) { $order_id = $Payqr->objectOrder->getOrderId(); if (empty($order_id)) { return false; } $status_paid = payqr_status::getInstance($modx)->getStatusId($config['status_paid']); if (empty($status_paid)) { return false; } $payqrOrder = new payqr_order($modx, $Payqr); $payqrOrder->changeStatus($order_id, $status_paid); }