当前位置: 首页>>代码示例>>PHP>>正文


PHP EmailTemplate::replaceContent方法代码示例

本文整理汇总了PHP中EmailTemplate::replaceContent方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::replaceContent方法的具体用法?PHP EmailTemplate::replaceContent怎么用?PHP EmailTemplate::replaceContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EmailTemplate的用法示例。


在下文中一共展示了EmailTemplate::replaceContent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post_associateRegistration

 public function post_associateRegistration()
 {
     $post = array();
     $post['inputCid'] = Input::get('inputCid');
     $post['inputVaName'] = Input::get('inputVaName');
     $post['inputUrl'] = Input::get('inputUrl');
     $post['inputDescription'] = Input::get('inputDescription');
     $post['inputVatsimImagePageLink'] = Input::get('inputVatsimImagePageLink');
     $post['inputCountry'] = Input::get('inputCountry');
     $post['inputName'] = Input::get('inputName');
     $post['inputEmail'] = Input::get('inputEmail');
     $post['inputPassword'] = Input::get('inputPassword');
     $post['inputPassword_confirmation'] = Input::get('inputPassword_confirmation');
     //      Format our URL field with the http before if it isn't there already
     if (!strpos($post['inputUrl'], 'http://') and !strpos($post['inputUrl'], 'https://')) {
         $post['inputUrl'] = 'http://' . $post['inputUrl'];
     }
     $validator = Validator::make(array('Cid' => $post['inputCid'], 'Va Name' => $post['inputVaName'], 'Url' => $post['inputUrl'], 'Description' => $post['inputDescription'], 'Vatsim Image Page Link' => $post['inputVatsimImagePageLink'], 'Country' => $post['inputCountry'], 'Name' => $post['inputName'], 'Email' => $post['inputEmail'], 'Password' => $post['inputPassword'], 'Password_confirmation' => $post['inputPassword_confirmation']), array('Cid' => 'required|integer|unique:vas,cid', 'Va Name' => 'required', 'Url' => 'required|url', 'Description' => 'required|max:200', 'Vatsim Image Page Link' => 'required|url', 'Country' => 'required', 'Name' => 'required', 'Email' => 'required|email|unique:vas,email', 'Password' => 'required|min:6|confirmed', 'Password_confirmation' => 'required|min:6'), array('Cid.unique' => 'There is already an account with an active virtual airline with that CID.'));
     if ($validator->fails()) {
         // The given data did not pass validation
         $messages = $validator->messages();
         $errorStr = '';
         foreach ($messages->all('<li>:message</li>') as $message) {
             $errorStr .= '<div class="alert alert-error">' . $message . '</div>';
         }
         echo $errorStr;
     } else {
         //Submit Data
         //Create an instance of our model
         $vas = new User();
         //Map our fields
         $vas->cid = $post['inputCid'];
         //This is an associate
         $vas->associate = 1;
         //Hash our password
         $vas->password = Hash::make($post['inputPassword']);
         $vas->vaname = $post['inputVaName'];
         $vas->url = $post['inputUrl'];
         $vas->description = $post['inputDescription'];
         $vas->vatsimimagepagelink = $post['inputVatsimImagePageLink'];
         $vas->country = $post['inputCountry'];
         $vas->name = $post['inputName'];
         $vas->email = $post['inputEmail'];
         //All VAs must be approved first so the default status will be 0 for unapproved or not active.
         $vas->status = '0';
         //Save our data
         //            $vas->save();
         //TODO ^^^^^^^
         die;
         //Great, now let's send our welcome email to the member
         $template = SystemEmailTemplate::find('registration_received');
         $subject = $template->subject;
         $email = $post['inputEmail'];
         $content = EmailTemplate::replaceContent($template->content, $post['inputCid']);
         //Send our email
         $data = array('name' => $post['inputName'], 'email' => $email, 'subject' => $subject);
         //Alright. Time to do some email sending.
         Mail::send('email.default', array("content" => $content), function ($message) use($data) {
             $message->to($data['email'], $data['name'])->subject($data['subject']);
         });
     }
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:62,代码来源:AjaxController.php

示例2: post_email

 public function post_email()
 {
     //Get our form values
     $recipients = Input::get('inputRecipients');
     $subject = Input::get('inputSubject');
     $body = Input::get('inputBody');
     //Here we go
     if ($recipients == 0) {
         $vas = User::where('status', '=', 0)->get();
     } elseif ($recipients == 1) {
         $vas = User::where('status', '=', 1)->get();
     } elseif ($recipients == 2) {
         $vas = User::where('status', '=', 0)->orWhere('status', '=', 1)->get();
     }
     if (empty($vas)) {
         //Damn them they somehow didn't select a VA what idiots
         return Redirect::route('consoleemail')->with('message', 'Please select a recipient group');
     }
     if (empty($subject)) {
         return Redirect::route('consoleemail')->with('message', 'Please enter a subject');
     }
     if (empty($body)) {
         return Redirect::route('consoleemail')->with('message', 'Please enter an email body');
     }
     $i = 0;
     foreach ($vas as $va) {
         $body = EmailTemplate::replaceContent($body, $va->cid);
         $subject = EmailTemplate::replaceContent($subject, $va->cid);
         //Replace the email body variables
         $data = array('va' => $va, 'subject' => $subject);
         //Alright. Time to do some email sending.
         Mail::send('email.default', array("content" => $body), function ($message) use($data) {
             $message->to($data['va']->email, $data['va']->name)->subject($data['subject']);
         });
         $i += 1;
     }
     return Redirect::route('consoleemail')->with('message', 'Email successfully sent to <strong>' . $i . '</strong> vas.');
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:38,代码来源:ConsoleController.php


注:本文中的EmailTemplate::replaceContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。