Ejemplo n.º 1
0
 public function send($person, $view, $data, $subject)
 {
     $view = view_path($view);
     \Mail::send($view, $data, function ($message) use($person, $subject) {
         $message->to($person->email)->subject($subject);
     });
 }
Ejemplo n.º 2
0
 public function getTemplateIncludes($file)
 {
     preg_match_all('/<include\\s+(.*)>/', $file, $includes);
     $templates = $includes[1];
     foreach ($templates as $template) {
         $templatePath = view_path(trim(str_replace('.', '/', $template)));
         if (file_exists("{$templatePath}.lb")) {
             $templateFile = file_get_contents("{$templatePath}.lb");
         } else {
             throw new TemplateNotFoundException($template);
         }
         $file = preg_replace("/<include\\s+{$template}>/", $templateFile, $file);
     }
     return $file;
 }
Ejemplo n.º 3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $partsOfView = explode('.', $this->argument('view'));
     $nameOfFile = array_pop($partsOfView);
     $paths = implode('/', $partsOfView);
     if (!is_dir(view_path($paths))) {
         mkdir(view_path($paths), 0777, true);
     }
     $viewName = $paths . '/' . $nameOfFile . '.blade.php';
     if (file_exists(view_path($viewName))) {
         throw new \Exception("File already exists.");
     }
     File::put(view_path($viewName), '');
     $this->info('File created.');
 }
 public function handle($exception)
 {
     Log::exception($exception);
     if (PHP_SAPI == 'cli') {
         echo $exception->getMessage();
         echo "\r\n";
         die;
     }
     if (defined('EXCEPTIONS_TEMPLATE')) {
         $template = EXCEPTIONS_TEMPLATE;
     }
     if (isset($template) && file_exists(view_path("{$template}.lb"))) {
         $view = new View($template, ['exception' => $exception]);
     } else {
         $view = new View('exceptions', ['exception' => $exception], __DIR__ . '/');
     }
     echo $view->render();
     die;
 }
Ejemplo n.º 5
0
 /**
  * Initialization
  *
  * @param string $template
  * @param array $variables
  */
 public function __construct($template, array $variables = [], $customPath = NULL, $compileVars = false)
 {
     if ($customPath) {
         $template = $customPath . str_replace('.', '/', $template);
     } else {
         $template = view_path(str_replace('.', '/', $template));
     }
     if (file_exists("{$template}.lb")) {
         $this->template = "{$template}.lb";
     } elseif (file_exists("{$template}.php")) {
         $this->template = "{$template}.php";
     } else {
         throw new TemplateNotFoundException($template);
     }
     if ($compileVars) {
         $this->variables = ViewCompiler::compileVariables($variables);
     } else {
         $this->variables = $variables;
     }
     $this->compileTemplate();
 }
Ejemplo n.º 6
0
 function View($name)
 {
     $this->name = $name;
     $this->path = view_path($name);
     require_once $this->path;
 }
Ejemplo n.º 7
0
<?php

return ['driver' => 'eloquent', 'model' => Modules\User\Entities\User::class, 'table' => 'users', 'login' => 'username', 'password' => ['email' => view_path('auth.mail.reset'), 'table' => 'password_resets', 'expire' => 60]];
Ejemplo n.º 8
0
<?php

return ['theme' => 'bootstrap', 'custom' => view_path('layouts/styde'), 'control_access' => true, 'translate_texts' => true, 'novalidate' => false, 'abbreviations' => ['ph' => 'placeholder', 'max' => 'maxlength', 'tpl' => 'template'], 'themes' => ['bootstrap' => ['field_templates' => ['checkbox' => 'checkbox', 'checkboxes' => 'collections', 'radios' => 'collections'], 'field_classes' => ['default' => 'form-control', 'checkbox' => '', 'error' => 'input-with-feedback']]]];
Ejemplo n.º 9
0
/**
 * include view and send arguments.
 *
 * @param string $view
 * @param array  $args
 */
function include_view($view, $args = array())
{
    if (!empty($args)) {
        extract($args);
    }
    include view_path() . $view . '.php';
}
Ejemplo n.º 10
0
<?php

// debug
ini_set("display_errors", "on");
// timezone
date_default_timezone_set('Asia/Shanghai');
// view path
view_path(__DIR__ . '/view/');
// db config
db_config();