Skip to content

Commit

Permalink
Global bladerunner supports no echo
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Ek committed Oct 29, 2016
1 parent c9aaea9 commit 3ace197
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bladerunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Bladerunner
Plugin URI: http://bladerunner.elseif.se
Description: Laravel Blade template engine for WordPress
Version: 1.5.1
Version: 1.5.2
Author: Andreas Ek
Author URI: https://www.elseif.se/
License: MIT License
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ekandreas/bladerunner",
"type": "wordpress-plugin",
"version": "1.5.1",
"version": "1.5.2",
"description": "WordPress Blade L5 template engine",
"keywords": ["laravel", "blade", "wordpress"],
"license": "MIT",
Expand Down
11 changes: 9 additions & 2 deletions plugin_globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @param string $view Name of the view with path, eg: views.pages.single
* @param array $data Any object data to use in the view template/file
*/
function bladerunner($view, $data = [])
function bladerunner($view, $data = [], $echo=true)
{
if (defined('WP_DEBUG') && true === WP_DEBUG) {
$files = glob(\Bladerunner\Cache::path().'/*');
Expand All @@ -24,7 +24,14 @@ function bladerunner($view, $data = [])

$bladepath = apply_filters('bladerunner/template/bladepath', get_stylesheet_directory());
$blade = new \Bladerunner\Blade($bladepath, \Bladerunner\Cache::path());
echo $blade->view()->make($view, $data)->render();

$result = $blade->view()->make($view, $data)->render();

if ($echo) {
echo $result;
}

return $result;
}
}

Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: ekandreas
Tags: Blade,templates,development,laravel
Requires at least: 4.4
Tested up to: 4.6
Stable tag: 1.5.1
Stable tag: 1.5.2
License: MIT

WordPress plugin for Blade L5 templating
Expand Down

2 comments on commit 3ace197

@ekandreas
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because the method is just the same with default value to echo=true.

@vinkla
Copy link
Collaborator

@vinkla vinkla commented on 3ace197 Nov 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sorry. Removed my comments earlier today.

Please sign in to comment.