本文整理汇总了PHP中CTextParser::html_cut方法的典型用法代码示例。如果您正苦于以下问题:PHP CTextParser::html_cut方法的具体用法?PHP CTextParser::html_cut怎么用?PHP CTextParser::html_cut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTextParser
的用法示例。
在下文中一共展示了CTextParser::html_cut方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arResult["SECTION_DESCRIPTION"] = "";
if ($this->SECTION_ID > 0) {
$arSelect = array("ID", "IBLOCK_ID", "LEFT_MARGIN", "RIGHT_MARGIN");
if ($arParams["SECTION_TITLE"] !== "") {
$arSelect[] = $arParams["SECTION_TITLE"];
}
if ($arParams["SECTION_DESCRIPTION"] !== "") {
$arSelect[] = $arParams["SECTION_DESCRIPTION"];
}
$sectionList = CIBlockSection::GetList(array(), array("=ID" => $this->SECTION_ID, "IBLOCK_ID" => $this->IBLOCK_ID), false, $arSelect);
$arResult["SECTION"] = $sectionList->GetNext();
if ($arResult["SECTION"]) {
$arResult["SECTION_TITLE"] = $arResult["SECTION"][$arParams["SECTION_TITLE"]];
if ($arParams["SECTION_DESCRIPTION"] !== "") {
$obParser = new CTextParser();
$arResult["SECTION_DESCRIPTION"] = $obParser->html_cut($arResult["SECTION"][$arParams["SECTION_DESCRIPTION"]], 200);
}
}
}
}
$this->EndResultCache();
} else {
$this->facet->setPrices($arResult["PRICES"]);
$this->facet->setSectionId($this->SECTION_ID);
}
/*Handle checked for checkboxes and html control value for numbers*/
if (isset($_REQUEST["ajax"]) && $_REQUEST["ajax"] === "y") {
$_CHECK =& $_REQUEST;
} elseif (isset($_REQUEST["del_filter"])) {
$_CHECK = array();
} elseif (isset($_GET["set_filter"])) {
示例2: array
$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices(0, $arParams["PRICE_CODE"]);
} else {
$arResult["PRICES"] = array();
}
$arSelect = array("ID", "IBLOCK_ID", "PREVIEW_TEXT", "PREVIEW_PICTURE", "DETAIL_PICTURE");
$arFilter = array("IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R");
foreach ($arResult["PRICES"] as $value) {
$arSelect[] = $value["SELECT"];
$arFilter["CATALOG_SHOP_QUANTITY_" . $value["ID"]] = 1;
}
$arFilter["=ID"] = $arResult["ELEMENTS"];
$rsElements = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($arElement = $rsElements->Fetch()) {
$arElement["PRICES"] = CIBlockPriceTools::GetItemPrices($arElement["IBLOCK_ID"], $arResult["PRICES"], $arElement, $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
if ($arParams["PREVIEW_TRUNCATE_LEN"] > 0) {
$arElement["PREVIEW_TEXT"] = $obParser->html_cut($arElement["PREVIEW_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]);
}
$arResult["ELEMENTS"][$arElement["ID"]] = $arElement;
}
}
foreach ($arResult["SEARCH"] as $i => $arItem) {
switch ($arItem["MODULE_ID"]) {
case "iblock":
if (array_key_exists($arItem["ITEM_ID"], $arResult["ELEMENTS"])) {
$arElement =& $arResult["ELEMENTS"][$arItem["ITEM_ID"]];
if ($arParams["SHOW_PREVIEW"] == "Y") {
if ($arElement["PREVIEW_PICTURE"] > 0) {
$arElement["PICTURE"] = CFile::ResizeImageGet($arElement["PREVIEW_PICTURE"], array("width" => $PREVIEW_WIDTH, "height" => $PREVIEW_HEIGHT), BX_RESIZE_IMAGE_PROPORTIONAL, true);
} elseif ($arElement["DETAIL_PICTURE"] > 0) {
$arElement["PICTURE"] = CFile::ResizeImageGet($arElement["DETAIL_PICTURE"], array("width" => $PREVIEW_WIDTH, "height" => $PREVIEW_HEIGHT), BX_RESIZE_IMAGE_PROPORTIONAL, true);
}
示例3: array
"NAME" => $arSection["NAME"],
"LINK" => $arSection["SECTION_PAGE_URL"]
);
}
}
foreach($arResult["ITEMS"] as $k => $arItem){
$previewPicture = CFile::ResizeImageGet(
$arItem["PREVIEW_PICTURE"],
array("width"=>$arParams["PREVIEW_PICTURE_MAX_WIDTH"],"height"=>$arParams["PREVIEW_PICTURE_MAX_HEIGHT"]),
BX_RESIZE_IMAGE_EXACT
);
$detailPicture = CFile::ResizeImageGet(
$arItem["DETAIL_PICTURE"],
array("width"=>$arParams["DETAIL_PICTURE_MAX_WIDTH"],"height"=>$arParams["DETAIL_PICTURE_MAX_HEIGHT"]),
BX_RESIZE_IMAGE_EXACT
);
$obParser = new CTextParser;
$arResult["DATA"]["ARTICLES"][] = array(
"ID" => $arItem["ID"],
"NAME" => $arItem["NAME"],
"SECTION_ID" => $arItem["IBLOCK_SECTION_ID"],
"PREVIEW_PICTURE" => $previewPicture,
"PREVIEW_TEXT" => $obParser->html_cut($arItem["PREVIEW_TEXT"], 120),
"PREVIEW_TEXT_FULL" => $arItem["PREVIEW_TEXT"],
"DETAIL_PICTURE" => $detailPicture,
"DETAIL_TEXT" => $arItem["DETAIL_TEXT"],
"DETAIL_PAGE_URL" => $arItem["DETAIL_PAGE_URL"]
);
}
$arResult["DATA_JSON"] = json_encode($arResult["DATA"]);
?>
示例4: getProgInfoChannel
//.........这里部分代码省略.........
}
?>
"
data-type="broadcast" data-broadcast-id="<?php
echo $arProg["ID"];
?>
"
>
<div class="item-image-holder">
<img data-src="<?php
echo $arProg["PICTURE"]["SRC"];
?>
" alt="">
</div>
<?php
if ($time_pointer) {
?>
<span class="badge" data-channel-id="<?php
echo $arProg["UF_CHANNEL_ID"];
?>
">в эфире</span>
<?php
}
?>
<?php
echo $status_icon;
?>
<?php
echo self::driveNotifyMessage();
?>
<div class="item-header">
<time><?php
echo substr($arProg["DATE_START"], 11, 5);
?>
</time>
<a href="<?php
echo $arProg["DETAIL_PAGE_URL"];
?>
">
<?php
echo self::cutName(\Hawkart\Megatv\ProgTable::getName($arProg));
?>
</a>
</div>
<div class="item-header">
<?php
if (\CTimeEx::dateDiff($start, $datetime) && \CTimeEx::dateDiff($datetime, $end)) {
?>
<?php
$allSecs = strtotime($end) - strtotime($start);
$secs = strtotime($datetime) - strtotime($start);
$proc = ceil($secs / ($allSecs / 100));
$duration = \CTimeEx::secToStr($secs);
?>
<div class="timeline" data-progress="<?php
echo $proc;
?>
">
<span class="progress-bg"></span>
<span>прошло <?php
echo $duration;
?>
</span>
</div>
<?php
}
?>
<span class="descr-trigger" data-type="descr-trigger"><span>×</span></span>
<time><?php
echo substr($arProg["DATE_START"], 11, 5);
?>
</time>
<a href="<?php
echo $arProg["DETAIL_PAGE_URL"];
?>
">
<?php
echo self::cutName(\Hawkart\Megatv\ProgTable::getName($arProg));
?>
</a>
<div class="item-descr">
<?php
$obParser = new \CTextParser();
?>
<p><?php
echo $obParser->html_cut($arProg["UF_DESC"], 600);
?>
</p>
</div>
</div>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例5: MailNotifyAgent
public static function MailNotifyAgent()
{
global $DB;
$defSiteID = CSite::GetDefSite();
$arMark = array();
$arGroupNotify = array();
$arGroupNotifyUser = array();
$arUnsendNotify = CIMNotify::GetUnsendNotify();
foreach ($arUnsendNotify as $id => $arNotify) {
if (!isset($arMark[$arNotify["CHAT_ID"]]) || $arMark[$arNotify["CHAT_ID"]] < $arNotify["ID"]) {
$arMark[$arNotify["CHAT_ID"]] = $arNotify["ID"];
}
if ($arNotify['TO_USER_ACTIVE'] != 'Y') {
unset($arUnsendNotify[$id]);
continue;
}
if (isset($arNotify["NOTIFY_MODULE"]) && isset($arNotify["NOTIFY_EVENT"]) && !CIMNotifySchema::CheckEnableFeature($arNotify["NOTIFY_MODULE"], $arNotify["NOTIFY_EVENT"], IM_FEATURE_MAIL)) {
unset($arUnsendNotify[$id]);
continue;
}
$siteID = $arNotify["TO_USER_LID"];
if ($siteID == false || StrLen($siteID) <= 0) {
$siteID = $defSiteID;
if ($siteID == false || StrLen($siteID) <= 0) {
unset($arUnsendNotify[$id]);
continue;
}
}
if (strlen($arNotify["MESSAGE_OUT"]) <= 0) {
$arNotify["MESSAGE_OUT"] = $arNotify["MESSAGE"];
}
if (!(isset($arNotify["EMAIL_TEMPLATE"]) && strlen($arNotify["EMAIL_TEMPLATE"]) > 0)) {
$arNotify["EMAIL_TEMPLATE"] = "IM_NEW_NOTIFY";
}
$arNotify["USER"] = htmlspecialcharsback(CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arNotify["TO_USER_NAME"], "LAST_NAME" => $arNotify["TO_USER_LAST_NAME"], "SECOND_NAME" => $arNotify["TO_USER_SECOND_NAME"], "LOGIN" => $arNotify["TO_USER_LOGIN"]), true));
$arNotify["FROM_USER"] = htmlspecialcharsback(CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arNotify["FROM_USER_NAME"], "LAST_NAME" => $arNotify["FROM_USER_LAST_NAME"], "SECOND_NAME" => $arNotify["FROM_USER_SECOND_NAME"], "LOGIN" => $arNotify["FROM_USER_LOGIN"]), true));
$arNotify['NOTIFY_TAG_MD5'] = md5($arNotify['NOTIFY_TAG']);
if ($arNotify["EMAIL_TEMPLATE"] == "IM_NEW_NOTIFY" && $arNotify['NOTIFY_TAG'] != '') {
if (isset($arGroupNotify[$arNotify['NOTIFY_TAG_MD5']])) {
$arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']][$arNotify["FROM_USER_ID"]] = $arNotify["FROM_USER"];
unset($arUnsendNotify[$id]);
} else {
$arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']][$arNotify["FROM_USER_ID"]] = $arNotify["FROM_USER"];
$arGroupNotify[$arNotify['NOTIFY_TAG_MD5']] = true;
}
}
$arUnsendNotify[$id] = $arNotify;
}
foreach ($arMark as $chatId => $lastSendId) {
CIMNotify::SetLastSendId($chatId, $lastSendId);
}
$CTP = new CTextParser();
foreach ($arUnsendNotify as $id => $arNotify) {
$arFields = array("MESSAGE_ID" => $arNotify["ID"], "USER" => $arNotify["USER"], "USER_ID" => $arNotify["TO_USER_ID"], "USER_LOGIN" => $arNotify["TO_USER_LOGIN"], "USER_NAME" => $arNotify["TO_USER_NAME"], "USER_LAST_NAME" => $arNotify["TO_USER_LAST_NAME"], "USER_SECOND_NAME" => $arNotify["TO_USER_SECOND_NAME"], "DATE_CREATE" => $arNotify["DATE_CREATE"], "FROM_USER_ID" => $arNotify["FROM_USER_ID"], "FROM_USER_LOGIN" => $arNotify["FROM_USER_LOGIN"], "FROM_USER" => $arNotify["FROM_USER"], "SENDER_ID" => $arNotify["FROM_USER_ID"], "SENDER_LOGIN" => $arNotify["FROM_USER_LOGIN"], "SENDER_NAME" => $arNotify["FROM_USER_NAME"], "SENDER_LAST_NAME" => $arNotify["FROM_USER_LAST_NAME"], "SENDER_SECOND_NAME" => $arNotify["FROM_USER_SECOND_NAME"], "EMAIL_TO" => $arNotify["TO_USER_EMAIL"], "TITLE" => trim($arNotify["NOTIFY_TITLE"]), "MESSAGE" => CTextParser::convert4mail(str_replace("#BR#", "\n", strip_tags($arNotify["MESSAGE_OUT"]))), "MESSAGE_50" => $CTP->html_cut(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), nl2br(CTextParser::convert4mail(strip_tags($arNotify["MESSAGE_OUT"])))), 50));
if (strlen($arFields['TITLE']) > 0) {
$arFields["MESSAGE_50"] = $arFields['TITLE'];
} else {
$arFields["TITLE"] = $arFields['MESSAGE_50'];
}
if (isset($arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]) && count($arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]) > 1) {
$arNotify["EMAIL_TEMPLATE"] = "IM_NEW_NOTIFY_GROUP";
$arFields['FROM_USERS'] = implode(', ', $arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]);
unset($arFields['FROM_USER']);
}
$event = new CEvent();
$event->Send($arNotify["EMAIL_TEMPLATE"], $siteID, $arFields, "N");
}
return "CIMMail::MailNotifyAgent();";
}