本文整理汇总了PHP中clsTinyButStrong::f_Loc_Enlarge_Find方法的典型用法代码示例。如果您正苦于以下问题:PHP clsTinyButStrong::f_Loc_Enlarge_Find方法的具体用法?PHP clsTinyButStrong::f_Loc_Enlarge_Find怎么用?PHP clsTinyButStrong::f_Loc_Enlarge_Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clsTinyButStrong
的用法示例。
在下文中一共展示了clsTinyButStrong::f_Loc_Enlarge_Find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: f_Loc_EnlargeToTag
function f_Loc_EnlargeToTag(&$Txt, &$Loc, $TagStr, $RetInnerSrc)
{
//Modify $Loc, return false if tags not found, returns the inner source of tag if $RetInnerSrc=true
$AliasLst =& $GLOBALS['_TBS_BlockAlias'];
// Analyze string
$Ref = 0;
$LevelStop = 0;
$i = 0;
$TagFct = array();
$TagLst = array();
while ($TagStr !== '') {
// get next tag
$p = strpos($TagStr, '+');
if ($p === false) {
$t = $TagStr;
$TagStr = '';
} else {
$t = substr($TagStr, 0, $p);
$TagStr = substr($TagStr, $p + 1);
}
do {
// Check parentheses, relative position and single tag
$t = trim($t);
$e = strlen($t) - 1;
// pos of last char
if ($e > 1 && $t[0] === '(' && $t[$e] === ')') {
if ($Ref === 0) {
$Ref = $i;
}
if ($Ref === $i) {
$LevelStop++;
}
$t = substr($t, 1, $e - 1);
} else {
if ($e >= 0 && $t[$e] === '/') {
$t = substr($t, 0, $e);
}
// for compatibilty
$e = false;
}
} while ($e !== false);
if (isset($AliasLst[$t])) {
$a = $AliasLst[$t];
if (is_string($a)) {
if ($i > 999) {
return false;
}
// prevent from circular alias
$TagStr = $TagStr === '' ? $a : $a . '+' . $TagStr;
} else {
$TagLst[$i] = $t;
$TagFct[$i] = $a;
$i++;
}
} else {
$TagLst[$i] = $t;
$TagFct[$i] = false;
$i++;
}
}
$TagMax = $i - 1;
// Find tags that embeds the locator
if ($LevelStop === 0) {
$LevelStop = 1;
}
// First tag of reference
$TagO = clsTinyButStrong::f_Loc_Enlarge_Find($Txt, $TagLst[$Ref], $TagFct[$Ref], $Loc->PosBeg - 1, false, $LevelStop);
if ($TagO === false) {
return false;
}
$PosBeg = $TagO->PosBeg;
$LevelStop += -$TagO->RightLevel;
// RightLevel=1 only if the tag is single and embeds $Loc, otherwise it is 0
if ($LevelStop > 0) {
$TagC = clsTinyButStrong::f_Loc_Enlarge_Find($Txt, $TagLst[$Ref], $TagFct[$Ref], $Loc->PosEnd + 1, true, -$LevelStop);
if ($TagC == false) {
return false;
}
$PosEnd = $TagC->PosEnd;
$InnerLim = $TagC->PosBeg;
} else {
$PosEnd = $TagO->PosEnd;
$InnerLim = $PosEnd + 1;
}
$RetVal = true;
if ($RetInnerSrc) {
$RetVal = '';
if ($Loc->PosBeg > $TagO->PosEnd) {
$RetVal .= substr($Txt, $TagO->PosEnd + 1, min($Loc->PosBeg, $InnerLim) - $TagO->PosEnd - 1);
}
if ($Loc->PosEnd < $InnerLim) {
$RetVal .= substr($Txt, max($Loc->PosEnd, $TagO->PosEnd) + 1, $InnerLim - max($Loc->PosEnd, $TagO->PosEnd) - 1);
}
}
// Other tags forward
$TagC = true;
for ($i = $Ref + 1; $i <= $TagMax; $i++) {
$x = $TagLst[$i];
if ($x !== '' && $TagC !== false) {
$TagC = clsTinyButStrong::f_Loc_Enlarge_Find($Txt, $x, $TagFct[$i], $PosEnd + 1, true, 0);
//.........这里部分代码省略.........