本文整理汇总了PHP中CBlogTools::DeleteDoubleBR方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogTools::DeleteDoubleBR方法的具体用法?PHP CBlogTools::DeleteDoubleBR怎么用?PHP CBlogTools::DeleteDoubleBR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogTools
的用法示例。
在下文中一共展示了CBlogTools::DeleteDoubleBR方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arTmp["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arPost["AUTHOR_ID"]));
$arTmp["AuthorName"] = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arPost["AUTHOR_NAME"], $arPost["AUTHOR_LAST_NAME"], $arPost["AUTHOR_LOGIN"]);
if ($itemCnt == 0) {
$arTmp["FIRST"] = "Y";
}
$text = preg_replace("#\\[img\\](.+?)\\[/img\\]#is", "", $arPost["~DETAIL_TEXT"]);
$text = preg_replace("#\\[url(.+?)\\](.*?)\\[/url\\]#is", "\\2", $text);
$text = preg_replace("#\\[video(.+?)\\](.+?)\\[/video\\]#is", "", $text);
$text = preg_replace("#^(.+?)<cut[\\s]*(/>|>).*?\$#is", "\\1", $text);
$text = preg_replace("#^(.+?)\\[cut[\\s]*(/\\]|\\]).*?\$#is", "\\1", $text);
$text = preg_replace("#(\\[|<)(/?)(b|u|i|list|code|quote|url|img|color|font|/*)(.*?)(\\]|>)#is", "", $text);
$text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$text1 = $text;
$title = $p->convert($text1, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N"));
$text = $p->convert($text, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "N"));
$text = CBlogTools::DeleteDoubleBR($text);
$arTmp["TEXT_FORMATED"] = $text;
$arTmp["DATE_PUBLISH_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arTmp["DATE_PUBLISH"], CSite::GetDateFormat("FULL")));
if ($arTmp["MICRO"] == "Y") {
$arTmp["TITLE"] = TruncateText(str_replace(array("<br />", "<br>", "'", """, "<", ">"), "", $title), 60);
$arTmp["~TITLE"] = htmlspecialcharsback($arTmp["TITLE"]);
}
$itemCnt++;
$arResult[] = $arTmp;
$ids[] = $arTmp["ID"];
}
$arResult["IDS"] = $ids;
}
if ($arParams["CACHE_TIME"] > 0) {
$cache->EndDataCache(array("templateCachedData" => $this->GetTemplateCachedData(), "arResult" => $arResult));
}
示例2: array
$arPostsAll[] = $arPost;
}
if (!empty($arIdToGet)) {
$arResult["userCache"] = CBlogUser::GetUserInfoArray($arIdToGet, $arParams["PATH_TO_USER"], array("AVATAR_SIZE" => $arParams["AVATAR_SIZE"]));
foreach ($arResult["userCache"] as $userId => $arUserCache) {
$arUserCache["~AUTHOR_NAME"] = CUser::FormatName($arParams["NAME_TEMPLATE"], array("LAST_NAME" => $arUserCache["~LAST_NAME"], "NAME" => $arUserCache["~NAME"], "SECOND_NAME" => $arUserCache["~SECOND_NAME"], "LOGIN" => $arUserCache["~LOGIN"]), $arParams["SHOW_LOGIN"], false);
$arUserCache["AUTHOR_NAME"] = htmlspecialcharsbx($arUserCache["~AUTHOR_NAME"]);
$arResult["userCache"][$userId] = $arUserCache;
}
}
$db_user = CUser::GetById($GLOBALS["USER"]->GetId());
$arResult["USER"] = $db_user->Fetch();
foreach ($arPostsAll as $arPost) {
$text = preg_replace($patt, $repl, $arPost["~DETAIL_TEXT"]);
$text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$text = CBlogTools::DeleteDoubleBR($p->convert($text, true, false, $allow));
$arPost["~CLEAR_TEXT"] = $text;
$arPost["CLEAR_TEXT"] = $p->wrap_long_words($text);
$arPost["perms"] = $arResult["perms"];
if (!$bGroupMode && $arParams["USER_ID"] == $user_id && (empty($arParams["4ME"]) || $arPost["AUTHOR_ID"] == $user_id)) {
$arPost["perms"] = BLOG_PERMS_FULL;
} elseif (!$bGroupMode && $arParams["USER_ID"] != $user_id || strlen($arParams["4ME"]) > 0) {
$arPost["perms"] = CBlogPost::GetSocNetPostPerms($arPost["ID"], true);
}
$arUser = $arResult["userCache"][$arPost["AUTHOR_ID"]];
$arPost["~AUTHOR_NAME"] = $arUser["~AUTHOR_NAME"];
$arPost["AUTHOR_NAME"] = $arUser["AUTHOR_NAME"];
$arPost["AUTHOR_AVATAR"] = $arUser["PERSONAL_PHOTO_resized"];
$arPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"]));
$arPost["urlToPosts"] = CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_BLOG_POSTS"], array("user_id" => $arPost["BLOG_OWNER_ID"]));
$arPost["urlToPostsImportant"] = CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_POST_IMPORTANT"], array("user_id" => $arPost["BLOG_OWNER_ID"]));
示例3: preg_replace
}
$text = preg_replace(array("#\\[img\\](.+?)\\[/img\\]#ie", "/\\[document id=\\d+([^\\]]*)\\]/is"), "", $arPost["~DETAIL_TEXT"]);
$text = preg_replace("#\\[url(.+?)\\](.*?)\\[/url\\]#is", "\\2", $text);
$text = preg_replace("#\\[video(.+?)\\](.+?)\\[/video\\]#ie", "", $text);
$text = preg_replace("#^(.+?)<cut[\\s]*(/>|>).*?\$#is", "\\1", $text);
$text = preg_replace("#^(.+?)\\[cut[\\s]*(/\\]|\\]).*?\$#is", "\\1", $text);
$text = preg_replace("#(\\[|<)(/?)(b|u|i|list|code|quote|url|img|color|font|right|left|center|justify|/*)(.*?)(\\]|>)#is", "", $text);
$text1 = $text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$text = $p->convert($text, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "N"));
$text = CBlogTools::DeleteDoubleBR($text);
$arTmp["TEXT_FORMATED"] = $text;
$arTmp["DATE_PUBLISH_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arTmp["DATE_PUBLISH"], CSite::GetDateFormat("FULL")));
if ($arTmp["MICRO"] == "Y") {
$text1 = TruncateText($text1, 60);
$text1 = $p->convert($text1, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "N"));
$text1 = CBlogTools::DeleteDoubleBR($text1);
$arTmp["TITLE"] = str_replace(array("<br />", "<br>"), "", $text1);
$arTmp["~TITLE"] = htmlspecialcharsback($arTmp["TITLE"]);
if (strlen($arTmp["TITLE"]) <= 0) {
$arTmp["TITLE"] = $arPost["TITLE"];
$arTmp["~TITLE"] = $arPost["~TITLE"];
}
}
$user = CUser::GetByID($arPost["AUTHOR_ID"]);
$arTmp["arUser"] = $user->Fetch();
$itemCnt++;
$arResult[] = $arTmp;
$ids[] = $arTmp["ID"];
}
$arResult["IDS"] = $ids;
}
示例4: DeleteDoubleBR
function DeleteDoubleBR($text)
{
if(strpos($text, "<br />\r<br />") !== false)
{
$text = str_replace("<br />\r<br />", "<br />", $text);
return CBlogTools::DeleteDoubleBR($text);
}
if(strpos($text, "<br /><br />") !== false)
{
$text = str_replace("<br /><br />", "<br />", $text);
return CBlogTools::DeleteDoubleBR($text);
}
if(strpos($text, "<br />") == 0 && strpos($text, "<br />") !== false)
{
$text = substr($text, 6);
}
return $text;
}