3535 * @copyright Copyright (c) 2016-2024 Jorge Patricio Castro Castillo MIT License.
3636 * Don't delete this comment, its part of the license.
3737 * Part of this code is based in the work of Laravel PHP Components.
38- * @version 4.17
38+ * @version 4.17.1
3939 * @link https://github.com/EFTEC/BladeOne
4040 */
4141class BladeOne
4242{
4343 //<editor-fold desc="fields">
44- public const VERSION = '4.17 ' ;
44+ public const VERSION = '4.17.1 ' ;
4545 /** @var int BladeOne reads if the compiled file has changed. If it has changed,then the file is replaced. */
4646 public const MODE_AUTO = 0 ;
4747 /** @var int Then compiled file is always replaced. It's slow and it's useful for development. */
@@ -100,16 +100,12 @@ class BladeOne
100100 * @var bool if true then the variables defined in the "include" as arguments are scoped to work only
101101 * inside the "include" statement.<br>
102102 * 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>
113109 */
114110 public bool $ includeScope = false ;
115111 /**
@@ -251,16 +247,16 @@ class BladeOne
251247 *
252248 * @param string|null $templatePath If null then it uses (caller_folder)/views
253249 * @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>
264260 */
265261 public function __construct ($ templatePath = null , $ compiledPath = null , $ mode = 0 , $ commentMode = 0 )
266262 {
@@ -2199,7 +2195,8 @@ protected function postRun(?string $string)
21992195 return $ string ;
22002196 }
22012197 $ 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 ' ,
22032200 static function ($ matches ) use ($ me ) {
22042201 $ l0 = strlen ($ me ->escapeStack0 );
22052202 $ l1 = strlen ($ me ->escapeStack1 );
@@ -2208,8 +2205,6 @@ static function($matches) use ($me) {
22082205 return $ me ->yieldPushContent ($ items [0 ], $ items [1 ] ?? null );
22092206 //return is_array($r) ? $flagtxt . json_encode($r) : $flagtxt . $r;
22102207 }, $ string );
2211- // we returned the escape character.
2212- return $ result ;
22132208 }
22142209
22152210 /**
0 commit comments