/** * 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); }
function base_uri($extend_path = null) { return url()->getScheme() . remove_double_slash(url()->getHost() . '/' . $extend_path); }