|
3 | 3 | *
|
4 | 4 | * TinyButStrong - Template Engine for Pro and Beginners
|
5 | 5 | *
|
6 |
| - * @version 3.12.1 for PHP 5, 7, 8 |
7 |
| - * @date 2020-10-21 |
| 6 | + * @version 3.12.2 for PHP 5, 7, 8 |
| 7 | + * @date 2020-11-03 |
8 | 8 | * @link http://www.tinybutstrong.com Web site
|
9 | 9 | * @author http://www.tinybutstrong.com/onlyyou.html
|
10 | 10 | * @license http://opensource.org/licenses/LGPL-3.0 LGPL-3.0
|
@@ -655,7 +655,7 @@ class clsTinyButStrong {
|
655 | 655 | public $ExtendedMethods = array();
|
656 | 656 | public $ErrCount = 0;
|
657 | 657 | // Undocumented (can change at any version)
|
658 |
| -public $Version = '3.12.1'; |
| 658 | +public $Version = '3.12.2'; |
659 | 659 | public $Charset = '';
|
660 | 660 | public $TurboBlock = true;
|
661 | 661 | public $VarPrefix = '';
|
@@ -1761,7 +1761,8 @@ function meth_Locator_Replace(&$Txt,&$Loc,&$Value,$SubStart) {
|
1761 | 1761 | if ($Loc->PrmLst['magnet']==='#') {
|
1762 | 1762 | if (!isset($Loc->AttBeg)) {
|
1763 | 1763 | $Loc->PrmLst['att'] = '.';
|
1764 |
| - $this->f_Xml_AttFind($Txt,$Loc,true,$this->AttDelim); |
| 1764 | + // no moving because att info would be modified and thus become wrong regarding to the eventually cached source |
| 1765 | + $this->f_Xml_AttFind($Txt,$Loc,false,$this->AttDelim); |
1765 | 1766 | }
|
1766 | 1767 | if (isset($Loc->AttBeg)) {
|
1767 | 1768 | $Loc->MagnetId = -3;
|
@@ -1789,7 +1790,12 @@ function meth_Locator_Replace(&$Txt,&$Loc,&$Value,$SubStart) {
|
1789 | 1790 | case 0: break;
|
1790 | 1791 | case -1: $CurrVal = ' '; break; // Enables to avoid null cells in HTML tables
|
1791 | 1792 | case -2: $CurrVal = $Loc->PrmLst['ifempty']; break;
|
1792 |
| - case -3: $Loc->Enlarged = true; $Loc->PosBeg = $Loc->AttBegM; $Loc->PosEnd = $Loc->AttEnd; break; |
| 1793 | + case -3: |
| 1794 | + // magnet=# |
| 1795 | + $Loc->Enlarged = true; |
| 1796 | + $Loc->PosBeg = ($Txt[$Loc->AttBeg-1]===' ') ? $Loc->AttBeg-1 : $Loc->AttBeg; |
| 1797 | + $Loc->PosEnd = $Loc->AttEnd; |
| 1798 | + break; |
1793 | 1799 | case 1:
|
1794 | 1800 | $Loc->Enlarged = true;
|
1795 | 1801 | $this->f_Loc_EnlargeToTag($Txt,$Loc,$Loc->PrmLst['magnet'],false);
|
@@ -4845,8 +4851,9 @@ static function f_Loc_Sort(&$LocLst, $DelEmbd, $iFirst = 0) {
|
4845 | 4851 |
|
4846 | 4852 | /**
|
4847 | 4853 | * Prepare all informations to move a locator according to parameter "att".
|
4848 |
| - * @param mixed $MoveLocLst true to simple move the loc, or an array of loc to rearrange the list after the move. |
4849 |
| - * Note: rearrange doest not work with PHP4. |
| 4854 | + * |
| 4855 | + * @param false|true|array $MoveLocLst true to simple move the loc, or an array of loc to rearrange the list after the move. |
| 4856 | + * Note: rearrange doest not work with PHP4. |
4850 | 4857 | */
|
4851 | 4858 | static function f_Xml_AttFind(&$Txt,&$Loc,$MoveLocLst=false,$AttDelim=false,$LocLst=false) {
|
4852 | 4859 | // att=div#class ; att=((div))#class ; att=+((div))#class
|
@@ -4933,6 +4940,12 @@ static function f_Xml_AttFind(&$Txt,&$Loc,$MoveLocLst=false,$AttDelim=false,$Loc
|
4933 | 4940 |
|
4934 | 4941 | }
|
4935 | 4942 |
|
| 4943 | +/** |
| 4944 | + * Move a locator in the source from its original location to the attribute location. |
| 4945 | + * The new locator string is only '[]', no need to copy the full source since all parameters are saved in $Loc.* |
| 4946 | + * |
| 4947 | + * @param false|true|array $MoveLocLst If the function is called from the caching process, then this value is an array. |
| 4948 | + */ |
4936 | 4949 | static function f_Xml_AttMove(&$Txt, &$Loc, $AttDelim, &$MoveLocLst) {
|
4937 | 4950 |
|
4938 | 4951 | if ($AttDelim===false) $AttDelim = $Loc->AttDelimChr;
|
@@ -4990,11 +5003,8 @@ static function f_Xml_AttMove(&$Txt, &$Loc, $AttDelim, &$MoveLocLst) {
|
4990 | 5003 | $Loc->AttTagEnd += $InsLen;
|
4991 | 5004 | }
|
4992 | 5005 |
|
4993 |
| - $Loc->PrevPosBeg = $Loc->PosBeg; |
4994 |
| - $Loc->PrevPosEnd = $Loc->PosEnd; |
4995 | 5006 | $Loc->PosBeg = $PosBeg;
|
4996 | 5007 | $Loc->PosEnd = $PosEnd;
|
4997 |
| - $Loc->AttBegM = ($Txt[$Loc->AttBeg-1]===' ') ? $Loc->AttBeg-1 : $Loc->AttBeg; // for magnet=# |
4998 | 5008 |
|
4999 | 5009 | // for CacheField
|
5000 | 5010 | if (is_array($MoveLocLst)) {
|
|
0 commit comments