35
35
* @copyright Copyright (c) 2016-2024 Jorge Patricio Castro Castillo MIT License.
36
36
* Don't delete this comment, its part of the license.
37
37
* Part of this code is based in the work of Laravel PHP Components.
38
- * @version 4.17
38
+ * @version 4.17.1
39
39
* @link https://github.com/EFTEC/BladeOne
40
40
*/
41
41
class BladeOne
42
42
{
43
43
//<editor-fold desc="fields">
44
- public const VERSION = '4.17 ' ;
44
+ public const VERSION = '4.17.1 ' ;
45
45
/** @var int BladeOne reads if the compiled file has changed. If it has changed,then the file is replaced. */
46
46
public const MODE_AUTO = 0 ;
47
47
/** @var int Then compiled file is always replaced. It's slow and it's useful for development. */
@@ -100,16 +100,12 @@ class BladeOne
100
100
* @var bool if true then the variables defined in the "include" as arguments are scoped to work only
101
101
* inside the "include" statement.<br>
102
102
* If false (default value), then the variables defined in the "include" as arguments are defined globally.<br>
103
- * **Example: (includeScope=false)**<br>
104
- * ```
105
- * @include("template",['a1'=>'abc']) // a1 is equals to abc
106
- * @include("template",[]) // a1 is equals to abc
107
- * ```
108
- * **Example: (includeScope=true)**<br>
109
- * ```
110
- * @include("template",['a1'=>'abc']) // a1 is equals to abc
111
- * @include("template",[]) // a1 is not defined
112
- * ```
103
+ * <b>Example: (includeScope=false)</b><br>
104
+ * include("template",['a1'=>'abc']) // a1 is equals to abc<br>
105
+ * include("template",[]) // a1 is equals to abc<br>
106
+ * <br><b>Example: (includeScope=true)</b><br>
107
+ * include("template",['a1'=>'abc']) // a1 is equals to abc<br>
108
+ * include("template",[]) // a1 is not defined<br>
113
109
*/
114
110
public bool $ includeScope = false ;
115
111
/**
@@ -251,16 +247,16 @@ class BladeOne
251
247
*
252
248
* @param string|null $templatePath If null then it uses (caller_folder)/views
253
249
* @param string|null $compiledPath If null then it uses (caller_folder)/compiles
254
- * @param int $mode =[BladeOne::MODE_AUTO,BladeOne::MODE_DEBUG,BladeOne::MODE_FAST,BladeOne::MODE_SLOW][$i]<br>
255
- * **BladeOne::MODE_AUTO** (default mode)<br>
256
- * **BladeOne::MODE_DEBUG** errors will be more verbose, and it will compile code every
257
- * time<br>
258
- * **BladeOne::MODE_FAST** it will not check if the compiled file exists<br>
259
- * **BladeOne::MODE_SLOW** it will compile the code everytime<br>
260
- * @param int $commentMode =[0,1,2][$i] <br>
261
- * **0** comments are generated as php code.<br>
262
- * **1** comments are generated as html code<br>
263
- * **2** comments are ignored (no code is generated)<br>
250
+ * @param int $mode =[BladeOne::MODE_AUTO,BladeOne::MODE_DEBUG,BladeOne::MODE_FAST,BladeOne::MODE_SLOW][$i]<br>
251
+ * **BladeOne::MODE_AUTO** (default mode)<br>
252
+ * **BladeOne::MODE_DEBUG** errors will be more verbose, and it will compile code
253
+ * every time<br>
254
+ * **BladeOne::MODE_FAST** it will not check if the compiled file exists<br>
255
+ * **BladeOne::MODE_SLOW** it will compile the code everytime<br>
256
+ * @param int $commentMode =[0,1,2][$i] <br>
257
+ * **0** comments are generated as php code.<br>
258
+ * **1** comments are generated as html code<br>
259
+ * **2** comments are ignored (no code is generated)<br>
264
260
*/
265
261
public function __construct ($ templatePath = null , $ compiledPath = null , $ mode = 0 , $ commentMode = 0 )
266
262
{
@@ -2199,7 +2195,8 @@ protected function postRun(?string $string)
2199
2195
return $ string ;
2200
2196
}
2201
2197
$ me = $ this ;
2202
- $ result = preg_replace_callback ('/ ' . $ this ->escapeStack0 . '\s?([A-Za-z0-9_:() ,*.@$]+)\s? ' . $ this ->escapeStack1 . '/u ' ,
2198
+ // we returned the escape character.
2199
+ return preg_replace_callback ('/ ' . $ this ->escapeStack0 . '\s?([A-Za-z0-9_:() ,*.@$]+)\s? ' . $ this ->escapeStack1 . '/u ' ,
2203
2200
static function ($ matches ) use ($ me ) {
2204
2201
$ l0 = strlen ($ me ->escapeStack0 );
2205
2202
$ l1 = strlen ($ me ->escapeStack1 );
@@ -2208,8 +2205,6 @@ static function($matches) use ($me) {
2208
2205
return $ me ->yieldPushContent ($ items [0 ], $ items [1 ] ?? null );
2209
2206
//return is_array($r) ? $flagtxt . json_encode($r) : $flagtxt . $r;
2210
2207
}, $ string );
2211
- // we returned the escape character.
2212
- return $ result ;
2213
2208
}
2214
2209
2215
2210
/**
0 commit comments