예제 #1
0
 /**
  * A parser function or rebuilder to inline original file
  * into an email based html
  *
  * @param mixed $record assigned key from inliner config
  * @return null
  */
 protected function parse($record)
 {
     # - instatiate the package inliner
     $inliner = new CssToInlineStyles();
     # - let's get the views dir combine the record file
     $base_file = remove_double_slash(View::getViewsDir() . $record->file . '.*');
     # - now get all related glob
     $related_files = glob($base_file);
     if (empty($related_files) == true) {
         $this->comment('   System can\'t find the file: ' . $base_file);
         return;
     }
     # - set the html
     $inliner->setHTML(file_get_contents($related_files[0]));
     # - set the css files
     $inliner->setCSS($this->combineCss($record['css']));
     # -  get the dirname and file name
     $dirname = dirname($related_files[0]);
     $converted_name = basename($record->file) . '-inligned.volt';
     # - overwrite or create a file based on the dirname
     # and file name
     file_put_contents($dirname . '/' . $converted_name, rawurldecode($inliner->convert()));
     # - log, show some sucess
     $this->comment('   ' . basename($record->file) . ' inlined! saved as ' . $converted_name);
 }
예제 #2
0
 public function initialize($view, $records)
 {
     # - we require our mail to auto-set the configurations
     # in the functions, so we need to call the possible
     # functions that doesn't require human calls
     $functions = ['host', 'port', 'username', 'password', 'encryption'];
     foreach ($functions as $function) {
         # - if the provided config is empty, turn next loop
         if (empty($this->config->{$function})) {
             continue;
         }
         # - now call the functions
         $this->adapter->{$function}($this->config->{$function});
     }
     # - render the view as partial
     $body = View::take($view, $records);
     # - we need to insert the global mailer 'from'
     # and insert the body
     $this->adapter->from(config()->app->mailer->from)->body($body);
     # - now return the adapter, so that they could still pre-modify
     # the function values
     return $this->adapter;
 }
예제 #3
0
 public function testAction()
 {
     return View::make('test');
 }