コード例 #1
0
 function onAfterRender(Am_Event_AfterRender $event)
 {
     if ($this->done) {
         return;
     }
     if (preg_match('/thanks\\.phtml$/', $event->getTemplateName()) && $event->getView()->invoice && $event->getView()->payment) {
         $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getSaleCode($event->getView()->invoice, $event->getView()->payment) . "</body>", 1);
         if ($this->done) {
             $payment = $event->getView()->payment;
             $payment->data()->set(self::TRACKED_DATA_KEY, 1);
             $payment->save();
         }
     } elseif (preg_match('/signup\\/signup.*\\.phtml$/', $event->getTemplateName())) {
         $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getTrackingCode() . $this->getSignupCode() . "</body>", 1);
     } else {
         if ($user_id = $this->getDi()->auth->getUserId()) {
             $payments = $this->getDi()->invoicePaymentTable->findBy(array('user_id' => $user_id, 'dattm' => '>' . sqlTime('-5 days')));
             foreach ($payments as $payment) {
                 if ($payment->data()->get(self::TRACKED_DATA_KEY)) {
                     continue;
                 }
                 $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getSaleCode($payment->getInvoice(), $payment) . "</body>", 1);
                 if ($this->done) {
                     $payment->data()->set(self::TRACKED_DATA_KEY, 1);
                     $payment->save();
                 }
                 break;
             }
         }
         if (!$this->done && !(defined('AM_ADMIN') && AM_ADMIN) && !$this->getDi()->config->get("google_analytics_only_sales_code")) {
             $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getTrackingCode() . "</body>", 1);
         }
     }
 }
コード例 #2
0
ファイル: getclicky.php プロジェクト: grlf/eyedock
 function onAfterRender(Am_Event_AfterRender $event)
 {
     if ($this->done) {
         return;
     }
     if (preg_match('/thanks\\.phtml$/', $event->getTemplateName())) {
         $this->done += $event->replace("|</body>|i", $this->getSaleCode($event->getView()->invoice, $event->getView()->payment) . $this->getTrackingCode() . "</body>", 1);
     } elseif (!preg_match('/\\badmin\\b/', $t = $event->getTemplateName())) {
         $this->done += $event->replace("|</body>|i", $this->getTrackingCode() . "</body>", 1);
     }
 }
コード例 #3
0
 function onAfterRender(Am_Event_AfterRender $event)
 {
     if ($this->done) {
         return;
     }
     if (preg_match('/thanks\\.phtml$/', $event->getTemplateName())) {
         $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getSaleCode($event->getView()->invoice, $event->getView()->payment) . "</body>", 1);
     } elseif (preg_match('/signup\\.phtml$/', $event->getTemplateName())) {
         $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getTrackingCode() . $this->getSignupCode() . "</body>", 1);
     } elseif (!preg_match('/\\badmin\\b/', $t = $event->getTemplateName()) && !$this->getDi()->config->get("google_analytics_only_sales_code")) {
         $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getTrackingCode() . "</body>", 1);
     }
 }