本文整理汇总了PHP中clsTinyButStrong::f_Xml_FindTagStart方法的典型用法代码示例。如果您正苦于以下问题:PHP clsTinyButStrong::f_Xml_FindTagStart方法的具体用法?PHP clsTinyButStrong::f_Xml_FindTagStart怎么用?PHP clsTinyButStrong::f_Xml_FindTagStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clsTinyButStrong
的用法示例。
在下文中一共展示了clsTinyButStrong::f_Xml_FindTagStart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OpenDoc_ChangeCellType
function OpenDoc_ChangeCellType(&$Txt, &$Loc, $Ope, $IsMerging, &$Value)
{
// change the type of a cell in an ODS file
$Loc->PrmLst['odsok'] = true;
// avoid the field to be processed twice
if ($Ope === 'odsStr') {
return true;
}
static $OpeLst = array('odsNum' => 'float', 'odsPercent' => 'percentage', 'odsCurr' => 'currency', 'odsBool' => 'boolean', 'odsDate' => 'date', 'odsTime' => 'time');
$AttStr = 'office:value-type="string"';
$AttStr_len = strlen($AttStr);
if (!isset($OpeLst[$Ope])) {
return false;
}
$t0 = clsTinyButStrong::f_Xml_FindTagStart($Txt, 'table:table-cell', true, $Loc->PosBeg, false, true);
if ($t0 === false) {
return false;
}
// error in the XML structure
$te = strpos($Txt, '>', $t0);
if ($te === false || $te > $Loc->PosBeg) {
return false;
}
// error in the XML structure
$len = $te - $t0 + 1;
$tag = substr($Txt, $t0, $len);
$p = strpos($tag, $AttStr);
if ($p === false) {
return false;
}
// error: the cell was expected to have a string contents since it contains a TBS tag.
// replace the current string with blanck chars
$len = $Loc->PosEnd - $Loc->PosBeg + 1;
$Txt = substr_replace($Txt, str_repeat(' ', $len), $Loc->PosBeg, $len);
// prepare special formating for the value
$type = $OpeLst[$Ope];
$att_new = 'office:value-type="' . $type . '"';
$newfrm = false;
switch ($type) {
case 'float':
$att_new .= ' office:value="[]"';
break;
case 'percentage':
$att_new .= ' office:value="[]"';
break;
case 'currency':
$att_new .= ' office:value="[]"';
if (isset($Loc->PrmLst['currency'])) {
$att_new .= ' office:currency="' . $Loc->PrmLst['currency'] . '"';
}
break;
case 'boolean':
$att_new .= ' office:boolean-value="[]"';
break;
case 'date':
$att_new .= ' office:date-value="[]"';
$newfrm = 'yyyy-mm-ddThh:nn:ss';
break;
case 'time':
$att_new .= ' office:time-value="[]"';
$newfrm = '"PT"hh"H"nn"M"ss"S"';
break;
}
// replace the sring attribute with the new attribute
//$diff = strlen($att_new) - $AttStr_len;
$p_att = $t0 + $p;
$p_fld = $p_att + strpos($att_new, '[');
// new position of the fields in $Txt
$Txt = substr_replace($Txt, $att_new, $p_att, $AttStr_len);
// move the TBS field
$Loc->PosBeg = $p_fld;
$Loc->PosEnd = $p_fld + 1;
if ($IsMerging) {
// the field is currently beeing merged
if ($type === 'boolean') {
if ($Value) {
$Value = 'true';
} else {
$Value = 'false';
}
} elseif ($newfrm !== false) {
$prm = array('frm' => $newfrm);
$Value = $this->TBS->meth_Misc_Format($Value, $prm);
}
$Loc->ConvStr = false;
$Loc->ConvProtect = false;
} else {
if ($newfrm !== false) {
$Loc->PrmLst['frm'] = $newfrm;
}
}
}
示例2: FindStartTag
/**
* Search a start tag of an element in the TXT contents, and return an object if it is found.
* Instead of a TXT content, it can be an object of the class. Thus, the object is linked to a copy
* of the source of the parent element. The parent element can receive the changes of the object using method UpdateParent().
*/
static function FindStartTag(&$TxtOrObj, $Tag, $PosBeg, $Forward = true)
{
if (is_object($TxtOrObj)) {
$TxtOrObj->FindEndTag();
$Txt = $TxtOrObj->GetSrc();
if ($Txt === false) {
return false;
}
$Parent =& $TxtOrObj;
} else {
$Txt =& $TxtOrObj;
$Parent = false;
}
$PosBeg = clsTinyButStrong::f_Xml_FindTagStart($Txt, $Tag, true, $PosBeg, $Forward, true);
if ($PosBeg === false) {
return false;
}
return new clsTbsXmlLoc($Txt, $Tag, $PosBeg, null, $Parent);
}
示例3: tag_ChangeCellType
function tag_ChangeCellType(&$Txt, $Loc, $Type)
{
// Change the cell type. This function assumes that the current cell has a type set to String. String type is expected since the cell contains a TBS tag.
if ($Type === 'String') {
return true;
}
$t0 = clsTinyButStrong::f_Xml_FindTagStart($Txt, 'Data', true, $Loc->PosBeg, false, true);
if ($t0 === false) {
return false;
}
// error in the XML structure
$te = strpos($Txt, '>', $t0);
if ($te === false || $te > $Loc->PosBeg) {
return false;
}
// error in the XML structure
$len = $te - $t0 + 1;
$tag = substr($Txt, $t0, $len);
$len = strlen($tag);
$att = ' ss:Type="String"';
$att2 = ' ss:Type="' . $Type . '"';
$tag = str_replace($att, $att2, $tag);
$Txt = substr_replace($Txt, $tag, $t0, $len);
$diff = strlen($tag) - $len;
if ($diff !== 0) {
$Loc->PosBeg += $diff;
$Loc->PosEnd += $diff;
}
$this->tag_ChangeCellFormat($Loc, $Type);
return true;
}