本文整理汇总了PHP中QString::Truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP QString::Truncate方法的具体用法?PHP QString::Truncate怎么用?PHP QString::Truncate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::Truncate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _p
<div class="<?php
_p($_FORM->RenderTopicCss($_ITEM));
?>
" title="<?php
_p($_ITEM->SidenavTitle);
?>
" onmouseover="topicOver(this);" onmouseout="topicOut(this);" onclick="document.location='<?php
_p($_FORM->RenderTopicLink($_ITEM));
?>
'">
<div class="title"><div style="width: 600px;">
<a href="<?php
_p($_FORM->RenderTopicLink($_ITEM));
?>
" title="<?php
_p($_ITEM->SidenavTitle);
?>
"><?php
_p(QString::Truncate($_ITEM->Name, 60), false);
?>
</a>
</div></div>
<div class="count"><?php
_p($_ITEM->MessageCount);
?>
</div>
</div>
示例2: RenderAnswer
public function RenderAnswer(SignupEntry $objSignupEntry, $intFormQuestionId, $intFormQuestionTypeId)
{
$objAnswer = FormAnswer::LoadBySignupEntryIdFormQuestionId($objSignupEntry->Id, $intFormQuestionId);
if (!$objAnswer) {
return;
}
switch ($intFormQuestionTypeId) {
case FormQuestionType::YesNo:
if ($objAnswer->BooleanValue) {
return 'Yes';
}
break;
case FormQuestionType::SpouseName:
case FormQuestionType::Address:
case FormQuestionType::Gender:
case FormQuestionType::Phone:
case FormQuestionType::Email:
case FormQuestionType::ShortText:
case FormQuestionType::LongText:
case FormQuestionType::SingleSelect:
case FormQuestionType::MultipleSelect:
return QString::Truncate(QApplication::HtmlEntities($objAnswer->TextValue), 50);
case FormQuestionType::Number:
case FormQuestionType::Age:
return $objAnswer->IntegerValue;
case FormQuestionType::DateofBirth:
if ($objAnswer->DateValue) {
return $objAnswer->DateValue->ToString('MMM D YYYY');
}
break;
}
}
示例3: array
$strImageHtml = '<img style="float: left; margin-top: 5px; margin-right: 5px;" src="' . $strUrl . '"/>';
} else {
$strImageHtml = null;
}
$strAuthor = null;
// Try and deduce an author if applicable
$arrMatches = array();
if (preg_match('/([bByY][ A-Za-z\\-\']*)(\\[[A-Za-z0-9 \\/.,\\-_]*\\])/', $strDescription, $arrMatches)) {
$strAuthor = trim($arrMatches[1]);
$strDateTime = trim($arrMatches[2]);
$strDescription = trim(substr($strDescription, strlen($arrMatches[0])));
}
if ($strAuthor) {
$strHtml = sprintf('<div style="cursor: pointer;" onclick="document.location="%s";"><h1 style="font-size: 18px;">Featured Article</h1>%s<strong>%s</strong><br/><em>%s<br/>%s</em><br/>%s<br/><a href="%s" onclick="return false;">Read More</a></div>', QApplication::HtmlEntities($strLink), $strImageHtml, $strTitle, $strAuthor, $strDateTime, QString::Truncate($strDescription, 100), QApplication::HtmlEntities($strLink));
} else {
$strHtml = sprintf('<div style="cursor: pointer;" onclick="document.location="%s";"><h1 style="font-size: 18px;">Featured Article</h1>%s<strong>%s</strong><br/><em>%s</em><br/>%s<br/><a href="%s" onclick="return false;">Read More</a></div>', QApplication::HtmlEntities($strLink), $strImageHtml, $strTitle, $dttDateTime->ToString('MMMM D, YYYY'), QString::Truncate($strDescription, 100), QApplication::HtmlEntities($strLink));
}
$strHtmlArray[] = $strHtml;
}
}
///////////////////////
// Setup the JS/HTML (if applicable)
///////////////////////
if (count($strHtmlArray)) {
$strHtml = implode('<br/><br/>', $strHtmlArray);
$strHtml = '<img src="/uploads/mediaHeader.png" title="Abundant Living Online" style="position: relative; top: -15px; left: -10px; cursor: pointer;" onclick="document.location="http://abundantliving.alcf.net/"" /><br/>' . $strHtml;
$strHtml = str_replace('"', '\\"', $strHtml);
if (!is_dir(dirname(SYNDICATION_CACHE_PATH))) {
QApplication::MakeDirectory(dirname(SYNDICATION_CACHE_PATH), 0777);
}
file_put_contents(SYNDICATION_CACHE_PATH, 'document.getElementById("syndicatedContent").innerHTML = "' . $strHtml . '";');
示例4: RenderTitle
public function RenderTitle(Issue $objIssue)
{
$strVersionInfoArray = array();
if ($objFieldOption = $objIssue->GetFieldOptionForIssueField($this->objIssueFieldForQcodoVersion)) {
$strVersionInfoArray[] = 'Qcodo ' . $objFieldOption->Name;
}
if ($objFieldOption = $objIssue->GetFieldOptionForIssueField($this->objIssueFieldForPhpVersion)) {
$strVersionInfoArray[] = 'PHP ' . $objFieldOption->Name;
}
$strVersionInfo = '';
if (count($strVersionInfoArray)) {
$strVersionInfo = sprintf('<br/><em style="color: #777; font-size: 10px;">%s</em>', implode(', ', $strVersionInfoArray));
}
return sprintf('<a href="/issues/view.php/%s" style="font-weight: bold;">%s</a>%s', $objIssue->Id, QString::Truncate($objIssue->Title, 50, true), $strVersionInfo);
}