本文整理汇总了PHP中G::unhtmlentities方法的典型用法代码示例。如果您正苦于以下问题:PHP G::unhtmlentities方法的具体用法?PHP G::unhtmlentities怎么用?PHP G::unhtmlentities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::unhtmlentities方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replaceDataGridField
/**
* Replace Grid Values
* The tag @>GRID-NAME to open the grid and @<GRID-NAME to close the grid,
*
* @param type String $sContent
* @param type Array $aFields
* @return type String
*/
public function replaceDataGridField($sContent, $aFields, $nl2brRecursive = true)
{
$nrt = array("\n", "\r", "\t");
$nrthtml = array("(n /)", "(r /)", "(t /)");
$sContent = G::unhtmlentities($sContent);
$strContentAux = str_replace($nrt, $nrthtml, $sContent);
$iOcurrences = preg_match_all('/\\@(?:([\\>])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*(?:[\\\\][\\w\\W])?)*)\\))((?:\\s*\\[[\'"]?\\w+[\'"]?\\])+)?/', $strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences) {
$arrayGrid = array();
for ($i = 0; $i <= $iOcurrences - 1; $i++) {
$arrayGrid[] = $arrayMatch1[2][$i][0];
}
$arrayGrid = array_unique($arrayGrid);
foreach ($arrayGrid as $index => $value) {
if ($value !== "") {
$grdName = $value;
$strContentAux1 = $strContentAux;
$strContentAux = null;
$ereg = "/^(.*)@>" . $grdName . "(.*)@<" . $grdName . "(.*)\$/";
while (preg_match($ereg, $strContentAux1, $arrayMatch2)) {
$strData = null;
if (isset($aFields[$grdName]) && is_array($aFields[$grdName])) {
foreach ($aFields[$grdName] as $aRow) {
if ($nl2brRecursive) {
foreach ($aRow as $sKey => $vValue) {
if (!is_array($vValue)) {
$aRow[$sKey] = str_replace($nrt, $nrthtml, nl2br($aRow[$sKey]));
}
}
}
$strData = $strData . G::replaceDataField($arrayMatch2[2], $aRow);
}
}
$strContentAux1 = $arrayMatch2[1];
$strContentAux = $strData . $arrayMatch2[3] . $strContentAux;
}
$strContentAux = $strContentAux1 . $strContentAux;
}
}
}
$strContentAux = str_replace($nrthtml, $nrt, $strContentAux);
$sContent = $strContentAux;
if ($nl2brRecursive) {
foreach ($aFields as $sKey => $vValue) {
if (!is_array($vValue)) {
$aFields[$sKey] = nl2br($aFields[$sKey]);
}
}
}
$sContent = G::replaceDataField($sContent, $aFields);
return $sContent;
}
示例2: testUnhtmlentities
/**
* @covers G::unhtmlentities
* @todo Implement testUnhtmlentities().
*/
public function testUnhtmlentities()
{
$response = G::unhtmlentities('árbol');
$this->assertEquals($response, 'árbol');
}
示例3: RenderColumn
/**
* Show dynaform column
*
* @author Fernando Ontiveros Lira <fernando@colosa.com>
* @access public
* @param $intPos
* @param $strClass
* @param $strClassLink
* @param $number
* @param $renderTD if this value = 1, this function will include the TD tags
* @return void
*/
function RenderColumn($intPos = 0, $strClass = "tblCell", $strClassLink = "tblCellA", $number = 0, $renderTD = 1)
{
if (!defined('ENABLE_ENCRYPT')) {
define('ENABLE_ENCRYPT', 'no');
}
global $G_DATE_FORMAT;
global $G_TABLE_DATE_FORMAT;
$col = $this->Columns[$intPos];
switch (substr($col['Name'], 0, 1)) {
case '=':
// Si empieza con '=' entonces se toma como valor constante
$val = substr($col['Name'], 1, strlen($col['Name']) - 1);
break;
case '%':
// Si empieza con '%' entonces traducir/convertir el valor
$fieldname = substr($col['Name'], 1, strlen($col['Name']) - 1);
$val = $this->_row_values[$fieldname];
$val = $this->translateValue($this->_contexto, $val, SYS_LANG);
break;
default:
$fieldname = $col['Name'];
$val = isset($this->_row_values[$fieldname]) ? $this->_row_values[$fieldname] : '';
}
$res = "";
if ($this->show_nummbers and $intPos == 0) {
$res = "<td>{$number}</td>";
}
if (!(stristr($val, "script") === false)) {
$val = htmlentities($val, ENT_QUOTES, 'utf-8');
}
if ($renderTD == 1) {
$res .= "<td class=\"{$strClass}\" align=\"" . $col["Align"] . "\" height=\"25\"";
if ($col["Width"] > 0) {
$res .= " width=\"" . $col["Width"] . "\"";
}
$res .= "> ";
}
switch ($col["Type"]) {
case 'hidden':
return '';
break;
case "text":
if ($val != "") {
$res .= G::unhtmlentities($val, ENT_QUOTES, 'utf-8');
} else {
$res .= " ";
}
break;
case "text-dontSearch":
if ($val != "") {
$res .= G::unhtmlentities($val);
} else {
$res .= " ";
}
break;
case "html":
if ($val != "") {
$res .= $val;
} else {
$res .= " ";
}
break;
case "textPlain":
if ($val != "") {
$res .= $this->ParsingFromHtml(G::unhtmlentities($val), "300");
} else {
$res .= " ";
}
break;
case "currency":
if ($val != "") {
$aux = explode(' ', $val);
$format = number_format((double) $aux[0], 2, ".", ",");
$res .= htmlentities($format . ' ' . (isset($aux[1]) ? $aux[1] : ''), ENT_QUOTES, 'utf-8');
} else {
$res .= " ";
}
break;
case "currency2":
if ($val != "") {
$res .= G::NumberToCurrency($val);
} else {
$res .= "\$ 0.00";
}
break;
case "percentage2":
if ($val != "") {
$res .= G::NumberToPercentage($val);
//.........这里部分代码省略.........
示例4: __outputContent
/**
* TemplatePower::__outputContent()
*
* @param string $blockname
* @return void
* @access private
*/
public function __outputContent($blockname)
{
$numrows = sizeof($this->content[$blockname]);
for ($i = 0; $i < $numrows; $i++) {
$defblockname = $this->content[$blockname][$i][0];
for (reset($this->defBlock[$defblockname]); $k = key($this->defBlock[$defblockname]); next($this->defBlock[$defblockname])) {
if ($k[1] == 'C') {
print $this->defBlock[$defblockname][$k];
} elseif ($k[1] == 'V') {
$defValue = $this->defBlock[$defblockname][$k];
if (!isset($this->content[$blockname][$i]["_V:" . $defValue])) {
if (isset($this->globalvars[$defValue])) {
$value = $this->globalvars[$defValue];
} else {
//Verify if $defValue is like
// "xmlfile:ID_LABEL"
//if it is load an xml label.
//if not continues with non assigned value.
if (preg_match("/(.+):(.+)/", $defValue, $xmlreg)) {
$value = G::LoadTranslation($xmlreg[2]);
} else {
if ($this->showUnAssigned) {
//$value = '{'. $this->defBlock[ $defblockname ][$k] .'}';
$value = '{' . $defValue . '}';
} else {
$value = '';
}
}
}
} else {
$value = $this->content[$blockname][$i]["_V:" . $defValue];
}
if ($this->unhtmlentities) {
$value = G::unhtmlentities($value);
}
print $value;
} elseif ($k[1] == 'B') {
if (isset($this->content[$blockname][$i][$k])) {
$this->__outputContent($this->content[$blockname][$i][$k]);
}
}
}
}
}
示例5: generate
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array())
{
if ($sUID != '' && is_array($aFields) && $sPath != '') {
$nrt = array("\n", "\r", "\t");
$nrthtml = array("(n /)", "(r /)", "(t /)");
$sContent = G::unhtmlentities($sContent);
$strContentAux = str_replace($nrt, $nrthtml, $sContent);
$iOcurrences = preg_match_all('/\\@(?:([\\>])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*(?:[\\\\][\\w\\W])?)*)\\))((?:\\s*\\[[\'"]?\\w+[\'"]?\\])+)?/', $strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences) {
$arrayGrid = array();
for ($i = 0; $i <= $iOcurrences - 1; $i++) {
$arrayGrid[] = $arrayMatch1[2][$i][0];
}
$arrayGrid = array_unique($arrayGrid);
foreach ($arrayGrid as $index => $value) {
$grdName = $value;
$strContentAux1 = $strContentAux;
$strContentAux = null;
$ereg = "/^(.*)@>" . $grdName . "(.*)@<" . $grdName . "(.*)\$/";
while (preg_match($ereg, $strContentAux1, $arrayMatch2)) {
$strData = null;
if (isset($aFields[$grdName]) && is_array($aFields[$grdName])) {
foreach ($aFields[$grdName] as $aRow) {
foreach ($aRow as $sKey => $vValue) {
if (!is_array($vValue)) {
$aRow[$sKey] = nl2br($aRow[$sKey]);
}
}
$strData = $strData . G::replaceDataField($arrayMatch2[2], $aRow);
}
}
$strContentAux1 = $arrayMatch2[1];
$strContentAux = $strData . $arrayMatch2[3] . $strContentAux;
}
$strContentAux = $strContentAux1 . $strContentAux;
}
}
$strContentAux = str_replace($nrthtml, $nrt, $strContentAux);
$sContent = $strContentAux;
foreach ($aFields as $sKey => $vValue) {
if (!is_array($vValue)) {
$aFields[$sKey] = nl2br($aFields[$sKey]);
}
}
$sContent = G::replaceDataField($sContent, $aFields);
G::verifyPath($sPath, true);
//Start - Create .doc
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
$size = array();
$size["Letter"] = "216mm 279mm";
$size["Legal"] = "216mm 357mm";
$size["Executive"] = "184mm 267mm";
$size["B5"] = "182mm 257mm";
$size["Folio"] = "216mm 330mm";
$size["A0Oversize"] = "882mm 1247mm";
$size["A0"] = "841mm 1189mm";
$size["A1"] = "594mm 841mm";
$size["A2"] = "420mm 594mm";
$size["A3"] = "297mm 420mm";
$size["A4"] = "210mm 297mm";
$size["A5"] = "148mm 210mm";
$size["A6"] = "105mm 148mm";
$size["A7"] = "74mm 105mm";
$size["A8"] = "52mm 74mm";
$size["A9"] = "37mm 52mm";
$size["A10"] = "26mm 37mm";
$size["Screenshot640"] = "640mm 480mm";
$size["Screenshot800"] = "800mm 600mm";
$size["Screenshot1024"] = "1024mm 768mm";
$sizeLandscape["Letter"] = "279mm 216mm";
$sizeLandscape["Legal"] = "357mm 216mm";
$sizeLandscape["Executive"] = "267mm 184mm";
$sizeLandscape["B5"] = "257mm 182mm";
$sizeLandscape["Folio"] = "330mm 216mm";
$sizeLandscape["A0Oversize"] = "1247mm 882mm";
$sizeLandscape["A0"] = "1189mm 841mm";
$sizeLandscape["A1"] = "841mm 594mm";
$sizeLandscape["A2"] = "594mm 420mm";
$sizeLandscape["A3"] = "420mm 297mm";
$sizeLandscape["A4"] = "297mm 210mm";
$sizeLandscape["A5"] = "210mm 148mm";
$sizeLandscape["A6"] = "148mm 105mm";
$sizeLandscape["A7"] = "105mm 74mm";
$sizeLandscape["A8"] = "74mm 52mm";
$sizeLandscape["A9"] = "52mm 37mm";
$sizeLandscape["A10"] = "37mm 26mm";
$sizeLandscape["Screenshot640"] = "480mm 640mm";
$sizeLandscape["Screenshot800"] = "600mm 800mm";
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
if (!isset($aProperties['media'])) {
$aProperties['media'] = 'Letter';
}
if ($sLandscape) {
$media = $sizeLandscape[$aProperties['media']];
} else {
$media = $size[$aProperties['media']];
}
$marginLeft = '15';
if (isset($aProperties['margins']['left'])) {
$marginLeft = $aProperties['margins']['left'];
//.........这里部分代码省略.........
示例6: generate
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array())
{
if ($sUID != '' && is_array($aFields) && $sPath != '') {
$sContent = G::unhtmlentities($sContent);
$iAux = 0;
$iOcurrences = preg_match_all('/\\@(?:([\\>])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*(?:[\\\\][\\w\\W])?)*)\\))((?:\\s*\\[[\'"]?\\w+[\'"]?\\])+)?/', $sContent, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences) {
for ($i = 0; $i < $iOcurrences; $i++) {
preg_match_all('/@>' . $aMatch[2][$i][0] . '([\\w\\W]*)' . '@<' . $aMatch[2][$i][0] . '/', $sContent, $aMatch2, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
$sGridName = $aMatch[2][$i][0];
$sStringToRepeat = $aMatch2[1][0][0];
if (isset($aFields[$sGridName])) {
if (is_array($aFields[$sGridName])) {
$sAux = '';
foreach ($aFields[$sGridName] as $aRow) {
foreach ($aRow as $sKey => $vValue) {
if (!is_array($vValue)) {
$aRow[$sKey] = nl2br($aRow[$sKey]);
}
}
$sAux .= G::replaceDataField($sStringToRepeat, $aRow);
}
}
}
$sContent = str_replace('@>' . $sGridName . $sStringToRepeat . '@<' . $sGridName, $sAux, $sContent);
}
}
foreach ($aFields as $sKey => $vValue) {
if (!is_array($vValue)) {
$aFields[$sKey] = nl2br($aFields[$sKey]);
}
}
$sContent = G::replaceDataField($sContent, $aFields);
G::verifyPath($sPath, true);
/* Start - Create .doc */
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
$size = array();
$size["Letter"] = "216mm 279mm";
$size["Legal"] = "216mm 357mm";
$size["Executive"] = "184mm 267mm";
$size["B5"] = "182mm 257mm";
$size["Folio"] = "216mm 330mm";
$size["A0Oversize"] = "882mm 1247mm";
$size["A0"] = "841mm 1189mm";
$size["A1"] = "594mm 841mm";
$size["A2"] = "420mm 594mm";
$size["A3"] = "297mm 420mm";
$size["A4"] = "210mm 297mm";
$size["A5"] = "148mm 210mm";
$size["A6"] = "105mm 148mm";
$size["A7"] = "74mm 105mm";
$size["A8"] = "52mm 74mm";
$size["A9"] = "37mm 52mm";
$size["A10"] = "26mm 37mm";
$size["Screenshot640"] = "640mm 480mm";
$size["Screenshot800"] = "800mm 600mm";
$size["Screenshot1024"] = "1024mm 768mm";
$sizeLandscape["Letter"] = "279mm 216mm";
$sizeLandscape["Legal"] = "357mm 216mm";
$sizeLandscape["Executive"] = "267mm 184mm";
$sizeLandscape["B5"] = "257mm 182mm";
$sizeLandscape["Folio"] = "330mm 216mm";
$sizeLandscape["A0Oversize"] = "1247mm 882mm";
$sizeLandscape["A0"] = "1189mm 841mm";
$sizeLandscape["A1"] = "841mm 594mm";
$sizeLandscape["A2"] = "594mm 420mm";
$sizeLandscape["A3"] = "420mm 297mm";
$sizeLandscape["A4"] = "297mm 210mm";
$sizeLandscape["A5"] = "210mm 148mm";
$sizeLandscape["A6"] = "148mm 105mm";
$sizeLandscape["A7"] = "105mm 74mm";
$sizeLandscape["A8"] = "74mm 52mm";
$sizeLandscape["A9"] = "52mm 37mm";
$sizeLandscape["A10"] = "37mm 26mm";
$sizeLandscape["Screenshot640"] = "480mm 640mm";
$sizeLandscape["Screenshot800"] = "600mm 800mm";
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
if (!isset($aProperties['media'])) {
$aProperties['media'] = 'Letter';
}
if ($sLandscape) {
$media = $sizeLandscape[$aProperties['media']];
} else {
$media = $size[$aProperties['media']];
}
$marginLeft = '15';
if (isset($aProperties['margins']['left'])) {
$marginLeft = $aProperties['margins']['left'];
}
$marginRight = '15';
if (isset($aProperties['margins']['right'])) {
$marginRight = $aProperties['margins']['right'];
}
$marginTop = '15';
if (isset($aProperties['margins']['top'])) {
$marginTop = $aProperties['margins']['top'];
}
$marginBottom = '15';
if (isset($aProperties['margins']['bottom'])) {
$marginBottom = $aProperties['margins']['bottom'];
//.........这里部分代码省略.........