protected function GenerateController()
 {
     $this->console->line('Generating Controller: ' . $this->controllerName);
     $controller = \View::file(__DIR__ . '/Templates/controller.blade.php', $this->templateData)->render();
     $path = app_path() . '/Http/Controllers/' . $this->controllerName . '.php';
     file_put_contents($path, $controller);
 }
Example #2
0
 public function render($article, $theme)
 {
     $articleType = $article->type();
     $template = $theme->templateForArticleType($articleType);
     $serialized = $article->serialized();
     return \View::file($template, $serialized)->render();
 }
 /**
  * Get render view
  *
  * @param array $parameters
  * @return string
  */
 public function getRender($parameters)
 {
     if ($this->base_template == config('message-sender.plain_template')) {
         return \View::make(config('message-sender.plain_template'), [config('message-sender.plain_value') => \View::file($this->getViewPath(), $parameters)->render()]);
     } else {
         $parameters['content'] = $this->content;
         $parameters['base_template'] = $this->base_template;
         return \View::file($this->getViewPath(), $parameters)->render();
     }
 }
 /**
  * @test
  */
 public function it_renders_the_admin_header_when_viewed_through_the_admin_interface()
 {
     \Auth::shouldReceive('check')->once()->andReturn(true);
     $rendered = \View::file($this->valid_path)->render();
     $this->assertContains("<!-- Spectre Editing Header -->", $rendered);
 }
Example #5
0
|
*/
Autoloader::directories(array(path('app') . 'models', path('app') . 'libraries'));
/*
|--------------------------------------------------------------------------
| Laravel View Loader
|--------------------------------------------------------------------------
|
| The Laravel view loader is responsible for returning the full file path
| for the given bundle and view. Of course, a default implementation is
| provided to load views according to typical Laravel conventions but
| you may change this to customize how your views are organized.
|
*/
Event::listen(View::loader, function ($bundle, $view) {
    return View::file($bundle, $view, Bundle::path($bundle) . 'views');
});
/*
|--------------------------------------------------------------------------
| Laravel Language Loader
|--------------------------------------------------------------------------
|
| The Laravel language loader is responsible for returning the array of
| language lines for a given bundle, language, and "file". A default
| implementation has been provided which uses the default language
| directories included with Laravel.
|
*/
Event::listen(Lang::loader, function ($bundle, $language, $file) {
    return Lang::file($bundle, $language, $file);
});
Example #6
0
 if (IoC::registered('twig::loader')) {
     $loader = IoC::resolve('twig::loader');
 } else {
     $loader = new Laravel_Twig_Loader($ext);
 }
 /**
  * Hook into the Laravel view loader
  */
 Laravel\Event::override(Laravel\View::loader, function ($bundle, $view) use($loader, $ext) {
     // Use the custom Laravel Twig loader for Twig views...
     if (starts_with($view, 'twig|')) {
         return $loader->getPath($bundle, substr($view, 5));
     } elseif (starts_with($bundle, 'twig|')) {
         return $loader->getPath(substr($bundle, 5), $view);
     } else {
         return View::file($bundle, $view);
     }
 });
 /**
  * Hook into the Laravel view engine
  */
 Laravel\Event::listen(Laravel\View::engine, function ($view) use($loader, $cache, $ext, $debug, $autoescape) {
     // Only handle views that have the Twig marker
     if (!starts_with($view->view, 'twig|')) {
         return false;
     }
     // Load the Laravel Twig extensions
     require_once 'extensions/HTML.php';
     $twig = new Twig_Environment($loader, compact('cache', 'debug', 'autoescape'));
     // Register the Laravel Twig extensions
     $twig->addExtension(new Laravel_Twig_Extension());
Example #7
0
/**
 * Require the template file with WordPress environment.
 *
 * The globals are set up for the template file to ensure that the WordPress
 * environment is available from within the function. The query variables are
 * also available.
 *
 * @since 1.5.0
 *
 * @global array      $posts
 * @global WP_Post    $post
 * @global bool       $wp_did_header
 * @global WP_Query   $wp_query
 * @global WP_Rewrite $wp_rewrite
 * @global wpdb       $wpdb
 * @global string     $wp_version
 * @global WP         $wp
 * @global int        $id
 * @global object     $comment
 * @global int        $user_ID
 *
 * @param string $_template_file Path to template file.
 * @param bool   $require_once   Whether to require_once or require. Default true.
 */
function load_template($_template_file, $require_once = true)
{
    global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
    if (is_array($wp_query->query_vars)) {
        extract($wp_query->query_vars, EXTR_SKIP);
    }
    if (isset($s)) {
        $s = esc_attr($s);
    }
    if ($require_once === null) {
        return $_template_file;
    }
    extract(View::getShared(), EXTR_REFS);
    if ($isBlade = preg_match("/\\.blade\\.php\$/", $_template_file)) {
        $tplfile = str_replace(['Resources/views/', '.blade.php'], '', substr($_template_file, strlen(get_template_directory()) + 1));
        //echo View::make($tplfile)->with(array_except(get_defined_vars(), array('__data', '__path')));
        //echo View::file($_template_file)->with(array_except(get_defined_vars(), array('__data', '__path')) );
        try {
            error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
            echo View::file($_template_file)->with(array_except(get_defined_vars(), array('__data', '__path')))->render();
        } catch (Exception $e) {
            kd($e);
        }
        return '';
    }
    if ($require_once) {
        require_once $_template_file;
    } else {
        require $_template_file;
    }
}
Example #8
0
 /**
  * @test
  */
 function it_renders_update_source_when_viewed_through_the_admin_interface()
 {
     \Auth::shouldReceive('check')->once()->andReturn(true);
     $rendered = \View::file($this->valid_path)->render();
     $this->assertContains('<h1 data-live-update-source="title">Title</h1>', $rendered);
 }