Exemplo n.º 1
0
 public static function parse(Wpjb_Model_Email $mail, Wpjb_Model_Job $job, array $append)
 {
     $active = "active";
     if (!$job->is_active && !$job->is_approved) {
         $active = "inactive";
     }
     $time = strtotime($job->job_created_at);
     $newdate = strtotime('+' . $job->job_visible . ' day', $time);
     $expiration = date("Y-m-d H:i:s", $newdate);
     /* @var $job Wpjb_Model_Job */
     $exchangeArray = array("id" => $job->getId(), "created" => $job->job_created_at, "visible" => $job->job_visible, "price" => $job->paymentAmount(), "paid" => $job->paymentPaid(), "discount" => $job->paymentDiscount(), "company" => $job->company_name, "location" => $job->locationToString(), "email" => $job->company_email, "position_title" => $job->job_title, "listing_type" => $job->getType(true)->title, "category" => $job->getCategory(true)->title, "active" => $active, "url" => Wpjb_Project::getInstance()->getUrl() . "/" . Wpjb_Project::getInstance()->router()->linkTo("job", $job), "expiration" => $expiration);
     foreach ($append as $k => $v) {
         $exchangeArray[$k] = $v;
     }
     $body = $mail->mail_body;
     $mail_title = $mail->mail_title;
     foreach ($exchangeArray as $key => $value) {
         //$v = esc_html($value, false);
         $v = $value;
         $body = str_replace('{$' . $key . '}', $v, $body);
         $mail_title = str_replace('{$' . $key . '}', $v, $mail_title);
     }
     return array($mail_title, $body);
 }