/** * Return an instance of this class. * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Add content to the WC emails. * * @param object $order Order object. * @param bool $sent_to_admin Send to admin. * @param bool $plain_text Plain text or HTML. * * @return string Payment instructions. */ public function email_instructions($order, $sent_to_admin, $plain_text = false) { if ($sent_to_admin || 'on-hold' !== $order->status || $this->id !== $order->payment_method) { return; } $data = get_post_meta($order->id, '_wc_pagseguro_payment_data', true); if (isset($data['type'])) { if ($plain_text) { woocommerce_get_template('emails/plain-instructions.php', array('type' => $data['type'], 'link' => $data['link'], 'method' => $data['method'], 'installments' => $data['installments']), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path()); } else { woocommerce_get_template('emails/html-instructions.php', array('type' => $data['type'], 'link' => $data['link'], 'method' => $data['method'], 'installments' => $data['installments']), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path()); } } }