Skip to content

Commit cfd8609

Browse files
authored
Revert "Laravel 7 and autoload blade custom directives (#59)" (#62)
This reverts commit 695330f. moved to new branch
1 parent 695330f commit cfd8609

5 files changed

Lines changed: 8 additions & 46 deletions

File tree

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/.netbeans/
2-
/bkp/
3-
vendor/
2+
/bkp/

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,7 @@ In config\app.php, providers section:
7474
Config
7575
=======================
7676

77-
Default cache time for the compiled string template is 300 seconds (5 mins), this can be changed in the config file, env file, or when calling a view. The change is global to all string templates.
78-
79-
`STRING_BLADE_CACHE_TIMEOUT=300`
80-
81-
Autoloading of blade custom directives can be changed in the config and env files.
82-
83-
`STRING_BLADE_AUTOLOAD=false`
77+
Default cache time for the compiled string template is 300 seconds (5 mins), this can be changed in the config file or when calling a view. The change is global to all string templates.
8478

8579
Note: If using homestead or some other vm, the host handles the filemtime of the cache file. This means the vm may have a different time than the file. If the cache is not expiring as expected, check the times between the systems.
8680

config/blade.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
// How many seconds past compiled file last modified time to recompile the template
55
// A value of 0 is always recompile
66
// Note: homestead time verses pc time may be off
7-
'secondsTemplateCacheExpires' => env('STRING_BLADE_CACHE_TIMEOUT', 300),
7+
'secondsTemplateCacheExpires' => 300
88

9-
// Determine whether the service provider to autoload blade custom directives.
10-
'autoload_custom_directives' => env('STRING_BLADE_AUTOLOAD', false),
119
];

src/Compilers/StringBladeCompiler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,5 @@ public function isExpired($viewData)
132132

133133
return time() >= ($this->files->lastModified($compiled) + $viewData->secondsTemplateCacheExpires) ;
134134
}
135+
135136
}

src/StringBladeServiceProvider.php

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<?php
22
namespace Wpb\String_Blade_Compiler;
33

4+
use Illuminate\View\Engines\EngineResolver;
45
use Illuminate\View\FileViewFinder;
56
use Illuminate\View\ViewServiceProvider;
6-
use Illuminate\View\Engines\EngineResolver;
7-
use Illuminate\Contracts\Support\DeferrableProvider;
8-
use Wpb\String_Blade_Compiler\Engines\CompilerEngine;
97
use Wpb\String_Blade_Compiler\Compilers\StringBladeCompiler;
8+
use Wpb\String_Blade_Compiler\Engines\CompilerEngine;
109

11-
class StringBladeServiceProvider extends ViewServiceProvider implements DeferrableProvider
12-
{
10+
class StringBladeServiceProvider extends ViewServiceProvider{
1311

1412
/**
1513
* Register the service provider.
@@ -150,32 +148,4 @@ public function registerStringBladeEngine($resolver)
150148
return new CompilerEngine($app['stringblade.compiler']);
151149
});
152150
}
153-
154-
/**
155-
* Bootstrap any application services.
156-
*
157-
* @return void
158-
*/
159-
public function boot()
160-
{
161-
if(config('blade.autoload_custom_directives')) {
162-
$blade = app('blade.compiler');
163-
$string_blade = app('stringblade.compiler');
164-
165-
collect($blade->getCustomDirectives())
166-
->each(function($directive, $name) use ($string_blade) {
167-
$string_blade->directive($name, $directive);
168-
});
169-
}
170-
}
171-
172-
/**
173-
* Get the services provided by the provider.
174-
*
175-
* @return array
176-
*/
177-
public function provides()
178-
{
179-
return [StringBlade::class];
180-
}
181-
}
151+
}

0 commit comments

Comments
 (0)