当前位置: 首页>>代码示例>>PHP>>正文


PHP clsTinyButStrong::f_Xml_FindTag方法代码示例

本文整理汇总了PHP中clsTinyButStrong::f_Xml_FindTag方法的典型用法代码示例。如果您正苦于以下问题:PHP clsTinyButStrong::f_Xml_FindTag方法的具体用法?PHP clsTinyButStrong::f_Xml_FindTag怎么用?PHP clsTinyButStrong::f_Xml_FindTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clsTinyButStrong的用法示例。


在下文中一共展示了clsTinyButStrong::f_Xml_FindTag方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: f_Xml_GetPart

 static function f_Xml_GetPart(&$Txt, $TagLst, $AllIfNothing = false)
 {
     // Returns parts of the XML/HTML content, default is BODY.
     if ($TagLst === true or $TagLst === '') {
         $TagLst = 'body';
     }
     $x = '';
     $nothing = true;
     $TagLst = explode('+', $TagLst);
     // Build a clean list of tags
     foreach ($TagLst as $i => $t) {
         if (substr($t, 0, 1) == '(' and substr($t, -1, 1) == ')') {
             $t = substr($t, 1, strlen($t) - 2);
             $Keep = true;
         } else {
             $Keep = false;
         }
         $TagLst[$i] = array('t' => $t, 'k' => $Keep, 'b' => -1, 'e' => -1, 's' => false);
     }
     $PosOut = strlen($Txt);
     $Pos = 0;
     do {
         // Search new positions
         $TagMin = false;
         $PosMin = $PosOut;
         foreach ($TagLst as $i => $Tag) {
             if ($Tag['b'] < $Pos) {
                 $Loc = clsTinyButStrong::f_Xml_FindTag($Txt, $Tag['t'], true, $Pos, true, false, false);
                 if ($Loc === false) {
                     $Tag['b'] = $PosOut;
                     // tag not found, no more search on this tag
                 } else {
                     $Tag['b'] = $Loc->PosBeg;
                     $Tag['e'] = $Loc->PosEnd;
                     $Tag['s'] = substr($Txt, $Loc->PosEnd - 1, 1) === '/';
                     // true if it's a single tag
                 }
                 $TagLst[$i] = $Tag;
                 // update
             }
             if ($Tag['b'] < $PosMin) {
                 $TagMin = $i;
                 $PosMin = $Loc->PosBeg;
             }
         }
         // Add the part
         if ($TagMin !== false) {
             $Tag =& $TagLst[$TagMin];
             $Pos = $Tag['e'] + 1;
             if ($Tag['s']) {
                 // single tag
                 if ($Tag['k']) {
                     $x .= substr($Txt, $Tag['b'], $Tag['e'] - $Tag['b'] + 1);
                 }
             } else {
                 // search the closing tag
                 $Loc = clsTinyButStrong::f_Xml_FindTag($Txt, $Tag['t'], false, $Pos, true, false, false);
                 if ($Loc === false) {
                     $Tag['b'] = $PosOut;
                     // closing tag not found, no more search on this tag
                 } else {
                     $nothing = false;
                     if ($Tag['k']) {
                         $x .= substr($Txt, $Tag['b'], $Loc->PosEnd - $Tag['b'] + 1);
                     } else {
                         $x .= substr($Txt, $Tag['e'] + 1, $Loc->PosBeg - $Tag['e'] - 1);
                     }
                     $Pos = $Loc->PosEnd + 1;
                 }
             }
         }
     } while ($TagMin !== false);
     if ($AllIfNothing and $nothing) {
         return $Txt;
     }
     return $x;
 }
开发者ID:prolin99,项目名称:mobile_view,代码行数:77,代码来源:tbs_class_php5.php

示例2: FindEndTag

 function FindEndTag($Encaps = false)
 {
     if (is_null($this->SelfClosing)) {
         $pe = $this->PosEnd;
         $SelfClosing = substr($this->Txt, $pe - 1, 1) == '/';
         if (!$SelfClosing) {
             if ($Encaps) {
                 $loc = clsTinyButStrong::f_Xml_FindTag($this->Txt, $this->FindName(), null, $pe, true, -1, false, false);
                 if ($loc === false) {
                     return false;
                 }
                 $this->pET_PosBeg = $loc->PosBeg;
                 $this->PosEnd = $loc->PosEnd;
             } else {
                 $pe = clsTinyButStrong::f_Xml_FindTagStart($this->Txt, $this->FindName(), false, $pe, true, true);
                 if ($pe === false) {
                     return false;
                 }
                 $this->pET_PosBeg = $pe;
                 $pe = strpos($this->Txt, '>', $pe);
                 if ($pe === false) {
                     return false;
                 }
                 $this->PosEnd = $pe;
             }
         }
         $this->SelfClosing = $SelfClosing;
     }
     return true;
 }
开发者ID:jonasarts,项目名称:opentbs-bundle,代码行数:30,代码来源:tbs_plugin_opentbs.php

示例3: f_Xml_GetPart

function f_Xml_GetPart(&$Txt,$Tag,$KeepTags=false,$AllIfNothing=false) {
// This function returns a part of the HTML document, default is BODY.

	if (($Tag===true) or ($Tag==='')) $Tag = 'BODY';

	$x = false;

	if ($LocOpen = clsTinyButStrong::f_Xml_FindTag($Txt,$Tag,true,0,true,false,false)) {
		if ($LocClose = clsTinyButStrong::f_Xml_FindTag($Txt,$Tag,false,$LocOpen->PosEnd+1,true,false,false)) {
			if ($KeepTags) {
				$x = substr($Txt,$LocOpen->PosBeg,$LocClose->PosEnd - $LocOpen->PosBeg + 1);
			} else {
				$x = substr($Txt,$LocOpen->PosEnd+1,$LocClose->PosBeg - $LocOpen->PosEnd - 1);
			}
		}
	}

	if ($x===false) $x = ($AllIfNothing) ? $Txt : '';

	return $x;

}
开发者ID:rhertzog,项目名称:lcs,代码行数:22,代码来源:tinyButStrong.class.php

示例4: OpenDoc_SheetDeleteAndDisplay

 function OpenDoc_SheetDeleteAndDisplay()
 {
     if (!isset($this->OtbsSheetOk)) {
         return;
     }
     if (count($this->OtbsSheetDelete) == 0 && count($this->OtbsSheetVisible) == 0) {
         return;
     }
     $this->OpenDoc_SheetInit(true);
     $Txt = $this->TbsStoreGet($this->OpenDoc_Sheets_FileId, 'Sheet Delete and Display');
     $close = '</table:table>';
     $close_len = strlen($close);
     $styles_to_edit = array();
     // process sheet in rever order of their positions
     for ($idx = count($this->OpenDoc_Sheets) - 1; $idx >= 0; $idx--) {
         $loc = $this->OpenDoc_Sheets[$idx];
         $id = 'i:' . ($idx + 1);
         $name = 'n:' . $loc->PrmLst['table:name'];
         if (isset($this->OtbsSheetDelete[$name]) || isset($this->OtbsSheetDelete[$id])) {
             // Delete the sheet
             $p = strpos($Txt, $close, $loc->PosEnd);
             if ($p === false) {
                 return;
             }
             // XML error
             $Txt = substr_replace($Txt, '', $loc->PosBeg, $p + $close_len - $loc->PosBeg);
             unset($this->OtbsSheetDelete[$name]);
             unset($this->OtbsSheetDelete[$id]);
             unset($this->OtbsSheetVisible[$name]);
             unset($this->OtbsSheetVisible[$id]);
         } elseif (isset($this->OtbsSheetVisible[$name]) || isset($this->OtbsSheetVisible[$id])) {
             // Hide or dispay the sheet
             $visible = isset($this->OtbsSheetVisible[$name]) ? $this->OtbsSheetVisible[$name] : $this->OtbsSheetVisible[$id];
             $visible = $visible ? 'true' : 'false';
             if (isset($loc->PrmLst['table:style-name'])) {
                 $style = $loc->PrmLst['table:style-name'];
                 $new = $style . '_tbs_' . $visible;
                 if (!isset($styles_to_edit[$style])) {
                     $styles_to_edit[$style] = array();
                 }
                 $styles_to_edit[$style][$visible] = $new;
                 // mark the style to be edited
                 $pi = $loc->PrmPos['table:style-name'];
                 $Txt = substr_replace($Txt, $pi[4] . $new . $pi[4], $pi[2], $pi[3] - $pi[2]);
             }
             unset($this->OtbsSheetVisible[$name]);
             unset($this->OtbsSheetVisible[$id]);
         }
     }
     // process styles to edit
     if (count($styles_to_edit) > 0) {
         $close = '</style:style>';
         $close_len = strlen($close);
         $p = 0;
         while ($loc = clsTinyButStrong::f_Xml_FindTag($Txt, 'style:style', true, $p, true, false, true, false)) {
             $p = $loc->PosEnd;
             if (isset($loc->PrmLst['style:name'])) {
                 $name = $loc->PrmLst['style:name'];
                 if (isset($styles_to_edit[$name])) {
                     // retrieve the full source of the <style:style> element
                     $p = strpos($Txt, $close, $p);
                     if ($p === false) {
                         return;
                     }
                     // bug in the XML contents
                     $p = $p + $close_len;
                     $src = substr($Txt, $loc->PosBeg, $p - $loc->PosBeg);
                     // add the attribute, if missing
                     if (strpos($src, ' table:display="') === false) {
                         $src = str_replace('<style:table-properties ', '<style:table-properties table:display="true" ', $src);
                     }
                     // add new styles
                     foreach ($styles_to_edit[$name] as $visible => $newName) {
                         $not = $visible === 'true' ? 'false' : 'true';
                         $src2 = str_replace(' style:name="' . $name . '"', ' style:name="' . $newName . '"', $src);
                         $src2 = str_replace(' table:display="' . $not . '"', ' table:display="' . $visible . '"', $src2);
                         $Txt = substr_replace($Txt, $src2, $loc->PosBeg, 0);
                         $p = $p + strlen($src2);
                     }
                 }
             }
         }
     }
     // store the result
     $this->TbsStorePut($this->OpenDoc_Sheets_FileId, $Txt);
     $this->TbsSheetCheck();
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:87,代码来源:tbs_plugin_opentbs.php

示例5: f_Xml_GetPart

 function f_Xml_GetPart(&$Txt, $TagLst, $AllIfNothing = false)
 {
     // Returns parts of the XML/HTML content, default is BODY.
     if ($TagLst === true or $TagLst === '') {
         $Tag = 'BODY';
     }
     $x = '';
     $nothing = true;
     $TagLst = explode('+', $TagLst);
     foreach ($TagLst as $Tag) {
         $Tag = trim($Tag);
         $KeepTags = false;
         if (substr($Tag, 0, 1) == '(' and substr($Tag, -1, 1) == ')') {
             $Tag = substr($Tag, 1, strlen($Tag) - 2);
             $KeepTags = true;
         }
         $Pos = 0;
         while ($LocOpen = clsTinyButStrong::f_Xml_FindTag($Txt, $Tag, true, $Pos, true, false, false)) {
             $Pos = $LocOpen->PosEnd + 1;
             if ($LocClose = clsTinyButStrong::f_Xml_FindTag($Txt, $Tag, false, $Pos, true, false, false)) {
                 $Pos = $LocClose->PosEnd;
                 $nothing = false;
                 if ($KeepTags) {
                     $x .= substr($Txt, $LocOpen->PosBeg, $LocClose->PosEnd - $LocOpen->PosBeg + 1);
                 } else {
                     $x .= substr($Txt, $LocOpen->PosEnd + 1, $LocClose->PosBeg - $LocOpen->PosEnd - 1);
                 }
             }
         }
     }
     if ($AllIfNothing and $nothing) {
         return $Txt;
     }
     return $x;
 }
开发者ID:nydehi,项目名称:runuo-remote-admin-enrichment,代码行数:35,代码来源:tbs_class.php

示例6: tag_DelOptionalTableAtt

 function tag_DelOptionalTableAtt()
 {
     // Two Table attributes give the size of the zone, this zone may be extended after a MergeBlock()
     // Hopefully, those attributes are optional, so we delete them.
     $Txt =& $this->TBS->Source;
     $att_lst = array('ss:ExpandedColumnCount', 'ss:ExpandedRowCount');
     $Pos = 0;
     while (($Loc = clsTinyButStrong::f_Xml_FindTag($Txt, 'Table', true, $Pos, true, false, true, true)) !== false) {
         foreach ($att_lst as $att) {
             // delete the attributes by replacing them with spaces
             $att = strtolower($att);
             // The TBS method does turn attributes anmes into lowercase.
             if (isset($Loc->PrmPos[$att])) {
                 $p = $Loc->PrmPos[$att];
                 $n = $p[3] - $p[0] + 1;
                 $Txt = substr_replace($Txt, str_repeat(' ', $n), $p[0], $n);
             }
         }
         $Pos = $Loc->PosEnd + 1;
     }
 }
开发者ID:sterichards,项目名称:lib_tbs,代码行数:21,代码来源:tbs_plugin_excel.php


注:本文中的clsTinyButStrong::f_Xml_FindTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。