Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($status == 'Paid' || file_exists('/home/whmcs/invoices/' . (int)$invoiceid . '.pdf')) {
- if (get_class($pdf) != 'PDFDecorator') {
- class PDFDecorator {
- protected $_instance;
- public $_invoiceid = 0, $_multi_invoice = 0;
- public function __construct($instance) {
- $this->_instance = $instance;
- }
- public function __get($prop) {
- return $this->_instance->$prop;
- }
- public function __set($prop, $val) {
- return $this->_instance->$prop = $val;
- }
- public function __call($method, $args) {
- return call_user_func_array(array($this->_instance, $method), $args);
- }
- public function Output($name = 'doc.pdf', $dest = 'I') {
- if (!$this->_multi_invoice && $dest == 'S') {
- if (!file_exists('/home/whmcs/invoices/' . $this->_invoiceid . '.pdf'))
- $this->_instance->Output('/home/whmcs/invoices/' . $this->_invoiceid . '.pdf', 'F');
- return file_get_contents('/home/whmcs/invoices/' . $this->_invoiceid . '.pdf');
- }
- return $this->_instance->Output($name, $dest);
- }
- }
- $pdf = new PDFDecorator($pdf);
- }
- if ($pdf->_invoiceid)
- $pdf->_multi_invoice = 1;
- else
- $pdf->_invoiceid = (int)$invoiceid;
- }
- /* rest of invoicepdf.tpl */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement