本文整理汇总了PHP中QApplication::HtmlEntities方法的典型用法代码示例。如果您正苦于以下问题:PHP QApplication::HtmlEntities方法的具体用法?PHP QApplication::HtmlEntities怎么用?PHP QApplication::HtmlEntities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QApplication
的用法示例。
在下文中一共展示了QApplication::HtmlEntities方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetRightHtml
protected function GetRightHtml()
{
if ($this->strRightText) {
return sprintf('<span class="input-group-addon">%s</span>', \QApplication::HtmlEntities($this->strRightText));
}
return '';
}
示例2: ParsePostData
public function ParsePostData()
{
// Check to see if this Control's Value was passed in via the POST data
if (array_key_exists($this->strControlId, $_POST)) {
// It was -- update this Control's value with the new value passed in via the POST arguments
if ($this->strText != $_POST[$this->strControlId]) {
//$this->blnModified = true;
}
$this->strText = $_POST[$this->strControlId];
switch ($this->strCrossScripting) {
case QCrossScripting::Allow:
// Do Nothing, allow everything
break;
case QCrossScripting::HtmlEntities:
// Go ahead and perform HtmlEntities on the text
$this->strText = QApplication::HtmlEntities($this->strText);
break;
default:
// Deny the Use of CrossScripts
// Check for cross scripting patterns
// TODO: Change this to RegExp
$strText = strtolower($this->strText);
if (strpos($strText, '<script') !== false || strpos($strText, '<applet') !== false || strpos($strText, '<embed') !== false || strpos($strText, '<style') !== false || strpos($strText, '<link') !== false || strpos($strText, '<body') !== false || strpos($strText, '<iframe') !== false || strpos($strText, 'javascript:') !== false || strpos($strText, ' onfocus=') !== false || strpos($strText, ' onblur=') !== false || strpos($strText, ' onkeydown=') !== false || strpos($strText, ' onkeyup=') !== false || strpos($strText, ' onkeypress=') !== false || strpos($strText, ' onmousedown=') !== false || strpos($strText, ' onmouseup=') !== false || strpos($strText, ' onmouseover=') !== false || strpos($strText, ' onmouseout=') !== false || strpos($strText, ' onmousemove=') !== false || strpos($strText, ' onclick=') !== false || strpos($strText, '<object') !== false || strpos($strText, 'background:url') !== false) {
throw new QCrossScriptingException($this->strControlId);
}
}
}
}
示例3: GetEndScript
public function GetEndScript()
{
$strToReturn = parent::GetEndScript();
if (QDateTime::$Translate) {
$strShortNameArray = array();
$strLongNameArray = array();
$strDayArray = array();
$dttMonth = new QDateTime('2000-01-01');
for ($intMonth = 1; $intMonth <= 12; $intMonth++) {
$dttMonth->Month = $intMonth;
$strShortNameArray[] = '"' . $dttMonth->ToString('MMM') . '"';
$strLongNameArray[] = '"' . $dttMonth->ToString('MMMM') . '"';
}
$dttDay = new QDateTime('Sunday');
for ($intDay = 1; $intDay <= 7; $intDay++) {
$strDay = $dttDay->ToString('DDD');
$strDay = html_entity_decode($strDay, ENT_COMPAT, QApplication::$EncodingType);
if (function_exists('mb_substr')) {
$strDay = mb_substr($strDay, 0, 2);
} else {
// Attempt to account for multibyte day -- may not work if the third character is multibyte
$strDay = substr($strDay, 0, strlen($strDay) - 1);
}
$strDay = QApplication::HtmlEntities($strDay);
$strDayArray[] = '"' . $strDay . '"';
$dttDay->Day++;
}
$strArrays = sprintf('new Array(new Array(%s), new Array(%s), new Array(%s))', implode(', ', $strLongNameArray), implode(', ', $strShortNameArray), implode(', ', $strDayArray));
$strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", %s); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel'), $strArrays);
} else {
$strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", null); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel'));
}
return $strToReturn;
}
示例4: RenderValue
public function RenderValue(AttributeValue $objValue)
{
switch ($objValue->Attribute->AttributeDataTypeId) {
case AttributeDataType::Text:
return QApplication::HtmlEntities($objValue->TextValue);
case AttributeDataType::Checkbox:
return $objValue->BooleanValue ? 'Yes' : 'No';
case AttributeDataType::Date:
return $objValue->DateValue->ToString('MMMM D, YYYY');
case AttributeDataType::DateTime:
return $objValue->DatetimeValue->ToString('MMMM D, YYYY') . ' at ' . $objValue->DatetimeValue->ToString('h:mmz');
case AttributeDataType::ImmutableSingleDropdown:
case AttributeDataType::MutableSingleDropdown:
return $objValue->SingleAttributeOption != null ? QApplication::HtmlEntities($objValue->SingleAttributeOption->Name) : ' ';
case AttributeDataType::ImmutableMultipleDropdown:
case AttributeDataType::MutableMultipleDropdown:
$strArray = array();
foreach ($objValue->GetAttributeOptionAsMultipleArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
$strArray[] = '• ' . QApplication::HtmlEntities($objOption->Name);
}
return implode('<br/>', $strArray);
default:
throw new Exception('Unhandled Attribute Data Type');
}
}
示例5: lstParentGroup_Create
/**
* Create and setup QListBox lstParentGroup
* Overrides code-generated version by providing full hierarchy and NOT allowing for "looped families"
* @param string $strControlId optional ControlId to use
* @param QQCondition $objConditions not used
* @param QQClause[] $objOptionalClauses not used
* @return QListBox
*/
public function lstParentGroup_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null)
{
$this->lstParentGroup = new QListBox($this->objParentObject, $strControlId);
$this->lstParentGroup->Name = QApplication::Translate('Parent Group');
$this->lstParentGroup->AddItem(QApplication::Translate('- None -'), null);
$this->lstParentGroup->HtmlEntities = false;
// Setup and perform the Query
if (is_null($objCondition)) {
$objCondition = QQ::All();
}
$objParentGroupCursor = Group::QueryCursor($objCondition, $objOptionalClauses);
$intLevelToSkipUntil = null;
foreach (Group::LoadOrderedArrayByMinistryIdAndConfidentiality($this->objGroup->MinistryId, false) as $objGroup) {
if ($objGroup->Id == $this->objGroup->Id) {
$intLevelToSkipUntil = $objGroup->HierarchyLevel;
} else {
if (!is_null($intLevelToSkipUntil) && $objGroup->HierarchyLevel <= $intLevelToSkipUntil) {
$intLevelToSkipUntil = null;
}
}
if (is_null($intLevelToSkipUntil) && $objGroup->GroupTypeId == GroupType::GroupCategory) {
$strName = $objGroup->Name;
if ($objGroup->HierarchyLevel) {
$strName = str_repeat(' ', $objGroup->HierarchyLevel * 3) . '> ' . QApplication::HtmlEntities($strName);
}
$objListItem = new QListItem($strName, $objGroup->Id);
if ($this->objGroup->ParentGroup && $this->objGroup->ParentGroup->Id == $objGroup->Id) {
$objListItem->Selected = true;
}
$this->lstParentGroup->AddItem($objListItem);
}
}
// Return the QListBox
return $this->lstParentGroup;
}
示例6: SetupPanel
protected function SetupPanel()
{
if (!$this->objGroup->IsLoginCanView(QApplication::$Login)) {
$this->ReturnTo('/groups/');
}
$this->SetupViewControls(false, false);
$this->dtgMembers->SetDataBinder('dtgMembers_Bind', $this);
$this->txtFirstName = new QTextBox($this);
$this->txtFirstName->Name = 'First Name (Exact)';
$this->txtFirstName->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtFirstName->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtFirstName->AddAction(new QEnterKeyEvent(), new QTerminateAction());
$this->txtLastName = new QTextBox($this);
$this->txtLastName->Name = 'Last Name (Exact)';
$this->txtLastName->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtLastName->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtLastName->AddAction(new QEnterKeyEvent(), new QTerminateAction());
$this->lblQuery = new QLabel($this);
$this->lblQuery->Name = 'Search Parameters';
$this->lblQuery->Text = nl2br(QApplication::HtmlEntities($this->objGroup->SmartGroup->SearchQuery->Description));
$this->lblQuery->HtmlEntities = false;
if ($this->objGroup->CountEmailMessageRoutes()) {
$this->SetupEmailMessageControls();
}
$this->SetupSmsControls();
}
示例7: lblInternalNotes_Refresh
public function lblInternalNotes_Refresh()
{
if (strlen($strNote = trim($this->objSignupEntry->InternalNotes)) > 0) {
$this->lblInternalNotes->Text = nl2br(QApplication::HtmlEntities($strNote), true);
} else {
$this->lblInternalNotes->Text = '<span class="na">None</span>';
}
}
示例8: GetItemText
public function GetItemText()
{
$strHtml = \QApplication::HtmlEntities($this->strName);
if ($strAnchor = $this->strAnchor) {
$strHtml = \QHtml::RenderTag('a', ['href' => $strAnchor], $strHtml, false, true);
}
return $strHtml;
}
示例9: RenderNumber
public function RenderNumber(StewardshipContribution $objContribution)
{
if (strlen($objContribution->Source) > 7) {
return QApplication::HtmlEntities(substr($objContribution->Source, 0, 5) . '...');
} else {
return QApplication::HtmlEntities($objContribution->Source);
}
}
示例10: _b
/**
* Standard Print as Block function. To aid with possible cross-scripting vulnerabilities,
* this will automatically perform QApplication::HtmlEntities() unless otherwise specified.
*
* Difference between _b() and _p() is that _b() will convert any linebreaks to <br/> tags.
* This allows _b() to print any "block" of text that will have linebreaks in standard HTML.
*
* @param string $strString
* @param boolean $blnHtmlEntities
*/
function _b($strString, $blnHtmlEntities = true)
{
// Text Block Print
if ($blnHtmlEntities && gettype($strString) != 'object') {
print nl2br(QApplication::HtmlEntities($strString));
} else {
print nl2br($strString);
}
}
示例11: GetControlHtml
protected function GetControlHtml()
{
try {
// Figure Out the Path
$strPath = $this->RenderAsImgSrc(false);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
if ($this->strCachedActualFilePath) {
$objDimensions = getimagesize($this->strCachedActualFilePath);
// Setup Style and Other Attribute Information (EXCEPT for "BackColor")
// Use actual "Width" and "Height" values from cached image
$strBackColor = $this->strBackColor;
$strWidth = $this->strWidth;
$strHeight = $this->strHeight;
$this->strBackColor = null;
$this->strWidth = $objDimensions[0];
$this->strHeight = $objDimensions[1];
$strStyle = $this->GetStyleAttributes();
if ($strStyle) {
$strStyle = sprintf(' style="%s"', $strStyle);
}
$this->strBackColor = $strBackColor;
$this->strWidth = $strWidth;
$this->strHeight = $strHeight;
} else {
// Setup Style and Other Attribute Information (EXCEPT for "BackColor", "Width" and "Height")
$strBackColor = $this->strBackColor;
$strWidth = $this->strWidth;
$strHeight = $this->strHeight;
$this->strBackColor = null;
$this->strWidth = null;
$this->strHeight = null;
$strStyle = $this->GetStyleAttributes();
if ($strStyle) {
$strStyle = sprintf(' style="%s"', $strStyle);
}
$this->strBackColor = $strBackColor;
$this->strWidth = $strWidth;
$this->strHeight = $strHeight;
}
$strAlt = null;
if ($this->strAlternateText) {
$strAlt = ' alt="' . QApplication::HtmlEntities($this->strAlternateText) . '"';
}
// Render final "IMG SRC" tag
if (!$this->strHeight) {
$objDimensions = getimagesize($this->ImagePath);
$intRenderedHeight = $objDimensions[1] * $this->strWidth / $objDimensions[0];
$intDisplayedHeight = round($intRenderedHeight * 0.85);
} else {
$intDisplayedHeight = $this->strHeight;
}
$strToReturn = sprintf('<div %s style="background: url(%s); width: %spx; height: %spx; border: 2px solid #aaa;"></div>', $this->GetActionAttributes(), $strPath, $this->strWidth, $intDisplayedHeight);
return $strToReturn;
}
示例12: DisplayMonospacedText
function DisplayMonospacedText($strText)
{
$strText = QApplication::HtmlEntities($strText);
$strText = str_replace(' ', ' ', $strText);
$strText = str_replace(' ', ' ', $strText);
$strText = str_replace("\r", '', $strText);
$strText = str_replace("\n", '<br/>', $strText);
_p($strText, false);
}
示例13: _p
/**
* Standard Print function. To aid with possible cross-scripting vulnerabilities,
* this will automatically perform QApplication::HtmlEntities() unless otherwise specified.
*
* @param string $strString string value to print
* @param boolean $blnHtmlEntities perform HTML escaping on the string first
*/
function _p($strString, $blnHtmlEntities = true)
{
// Standard Print
if ($blnHtmlEntities && gettype($strString) != 'object') {
print QApplication::HtmlEntities($strString);
} else {
print $strString;
}
}
示例14: GetControlHtml
protected function GetControlHtml()
{
$strStyle = $this->GetStyleAttributes();
if ($strStyle) {
$strStyle = sprintf('style="%s"', $strStyle);
}
$strToReturn = sprintf('<a href="%s" id="%s" %s%s%s>%s</a>', $this->strLinkUrl, $this->strControlId, $this->GetTargetAtribute(), $this->GetAttributes(), $strStyle, $this->blnHtmlEntities ? QApplication::HtmlEntities($this->strText) : $this->strText);
return $strToReturn;
}
示例15: RenderGroupName
public function RenderGroupName(Group $objGroup)
{
$strName = sprintf('<a href="/groups/group.php#%s">%s</a>', $objGroup->Id, QApplication::HtmlEntities($objGroup->Name));
// Add Pointer
$intHierarchyLevel = $objGroup->HierarchyLevel - $this->objGroup->HierarchyLevel - 1;
$strName = $intHierarchyLevel ? '> ' . $strName : $strName;
// Add Indent
$strName = str_repeat(' ', $intHierarchyLevel) . $strName;
return $strName;
}