本文整理匯總了PHP中forumTextParser::clearAllTags方法的典型用法代碼示例。如果您正苦於以下問題:PHP forumTextParser::clearAllTags方法的具體用法?PHP forumTextParser::clearAllTags怎麽用?PHP forumTextParser::clearAllTags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類forumTextParser
的用法示例。
在下文中一共展示了forumTextParser::clearAllTags方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Add
public static function Add($arFields, $strUploadDir = false, $arParams = array())
{
global $DB;
$strUploadDir = $strUploadDir === false ? "forum/upload" : $strUploadDir;
if (!CForumMessage::CheckFields("ADD", $arFields)) {
return false;
}
$arForum = CForumNew::GetByID($arFields["FORUM_ID"]);
$arParams["SKIP_STATISTIC"] = $arParams["SKIP_STATISTIC"] == "Y" ? "Y" : "N";
$arParams["SKIP_INDEXING"] = $arParams["SKIP_INDEXING"] == "Y" || $arForum["INDEXATION"] != "Y" ? "Y" : "N";
$POST_MESSAGE = $arFields["POST_MESSAGE"];
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures($arForum);
$allow['SMILES'] = $arFields["USE_SMILES"] != "Y" ? 'N' : $allow['SMILES'];
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$POST_MESSAGE = CFilterUnquotableWords::Filter($POST_MESSAGE);
$arFields["POST_MESSAGE_FILTER"] = empty($POST_MESSAGE) ? "*" : $POST_MESSAGE;
}
/***************** Attach ******************************************/
$arFiles = array();
if (is_array($arFields["ATTACH_IMG"])) {
$arFields["FILES"] = array($arFields["ATTACH_IMG"]);
}
unset($arFields["ATTACH_IMG"]);
if (is_array($arFields["FILES"]) && !empty($arFields["FILES"])) {
$res = array("FORUM_ID" => $arFields["FORUM_ID"], "USER_ID" => $arFields["AUTHOR_ID"], "upload_dir" => $strUploadDir);
$arFiles = CForumFiles::Save($arFields["FILES"], $res, false);
if (!empty($arFiles)) {
$arFiles = array_keys($arFiles);
sort($arFiles);
$arFields["ATTACH_IMG"] = $arFiles[0];
$arFields["ATTACHED_FILES"] = $arFiles;
}
unset($arFields["FILES"]);
}
/***************** Attach/******************************************/
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y") {
$POST_MESSAGE = $parser->convert($POST_MESSAGE, $allow, "html", $arFiles);
}
$arFields["POST_MESSAGE_HTML"] = $POST_MESSAGE;
/***************** Event onBeforeMessageAdd ************************/
foreach (GetModuleEvents("forum", "onBeforeMessageAdd", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields, &$strUploadDir)) === false) {
return false;
}
}
/***************** /Event ******************************************/
if (empty($arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_forum_message", $arFields, $strUploadDir);
$strDatePostField = "";
$strDatePostValue = "";
if (!is_set($arFields, "POST_DATE")) {
$strDatePostField = ", POST_DATE";
$strDatePostValue = ", " . $DB->GetNowFunction() . "";
}
$strSql = "INSERT INTO b_forum_message(" . $arInsert[0] . $strDatePostField . ") VALUES(" . $arInsert[1] . $strDatePostValue . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = intVal($DB->LastID());
/***************** Attach ******************************************/
if (!empty($arFiles)) {
CForumFiles::UpdateByID($arFiles, array("FORUM_ID" => $arFields["FORUM_ID"], "TOPIC_ID" => $arFields["TOPIC_ID"], "MESSAGE_ID" => $ID));
}
/***************** Attach/******************************************/
/***************** Quota *******************************************/
$_SESSION["SESS_RECOUNT_DB"] = "Y";
$GLOBALS["USER_FIELD_MANAGER"]->Update("FORUM_MESSAGE", $ID, $arFields);
if ($arParams["SKIP_STATISTIC"] == "Y" && $arParams["SKIP_INDEXING"] == "Y") {
return $ID;
}
$arMessage = CForumMessage::GetByIDEx($ID, array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "Y"));
if ($arParams["SKIP_STATISTIC"] != "Y") {
if (intVal($arMessage["AUTHOR_ID"]) > 0) {
CForumUser::SetStat($arMessage["AUTHOR_ID"], array("MESSAGE" => $arMessage));
}
CForumTopic::SetStat($arMessage["TOPIC_ID"], array("MESSAGE" => $arMessage));
CForumNew::SetStat($arMessage["FORUM_ID"], array("MESSAGE" => $arMessage));
}
/***************** Events onAfterMessageAdd ************************/
foreach (GetModuleEvents("forum", "onAfterMessageAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage, $arMessage["TOPIC_INFO"], $arMessage["FORUM_INFO"], $arFields));
}
/***************** /Events *****************************************/
if ($arMessage["APPROVED"] == "Y") {
if ($arParams["SKIP_INDEXING"] != "Y" && CModule::IncludeModule("search")) {
$arMessage["POST_MESSAGE"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
$arParams = array("PERMISSION" => array(), "SITE" => CForumNew::GetSites($arMessage["FORUM_ID"]), "DEFAULT_URL" => "/");
$arGroups = CForumNew::GetAccessPermissions($arMessage["FORUM_ID"]);
foreach ($arGroups as $arGroup) {
if ($arGroup[1] >= "E") {
$arParams["PERMISSION"][] = $arGroup[0];
if ($arGroup[0] == 2) {
break;
}
}
}
$arSearchInd = array("LID" => array(), "LAST_MODIFIED" => $arMessage["POST_DATE"], "PARAM1" => $arMessage["FORUM_ID"], "PARAM2" => $arMessage["TOPIC_ID"], "ENTITY_TYPE_ID" => $arMessage["NEW_TOPIC"] == "Y" ? "FORUM_TOPIC" : "FORUM_POST", "ENTITY_ID" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_ID"] : $ID, "USER_ID" => $arMessage["AUTHOR_ID"], "PERMISSIONS" => $arParams["PERMISSION"], "TITLE" => $arMessage["TOPIC_INFO"]["TITLE"] . ($arMessage["NEW_TOPIC"] == "Y" && !empty($arMessage["TOPIC_INFO"]["DESCRIPTION"]) ? ", " . $arMessage["TOPIC_INFO"]["DESCRIPTION"] : ""), "TAGS" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_INFO"]["TAGS"] : "", "BODY" => GetMessage("AVTOR_PREF") . " " . $arMessage["AUTHOR_NAME"] . ". " . forumTextParser::clearAllTags($arMessage["POST_MESSAGE"]), "URL" => "", "INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y");
// get mentions
$arMentionedUserID = CForumMessage::GetMentionedUserID($arMessage["POST_MESSAGE"]);
//.........這裏部分代碼省略.........
示例2: Reindex
function Reindex($ID, &$arMessage)
{
if (!($ID > 0) || !CModule::IncludeModule("search")) {
return array("FORUM_ID", "TOPIC_ID", "TITLE_SEO", "MESSAGE_ID", "SOCNET_GROUP_ID", "OWNER_ID", "PARAM1", "PARAM2");
}
if (!is_array($arMessage) || !array_key_exists("FORUM_INFO", $arMessage) || !array_key_exists("TOPIC_INFO", $arMessage)) {
$arMessage = CForumMessage::GetByIDEx($ID, array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y", "FILTER" => "Y"));
}
$arMessage["POST_MESSAGE"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
$arParams = array("PERMISSION" => array(), "SITE" => CForumNew::GetSites($arMessage["FORUM_ID"]), "DEFAULT_URL" => "/");
$arGroups = CForumNew::GetAccessPermissions($arMessage["FORUM_ID"]);
for ($i = 0; $i < count($arGroups); $i++) {
if ($arGroups[$i][1] >= "E") {
$arParams["PERMISSION"][] = $arGroups[$i][0];
if ($arGroups[$i][0] == 2) {
break;
}
}
}
$arSearchInd = array("LID" => array(), "LAST_MODIFIED" => $arMessage["POST_DATE"], "PARAM1" => $arMessage["FORUM_ID"], "PARAM2" => $arMessage["TOPIC_ID"], "PERMISSIONS" => $arParams["PERMISSION"], "TITLE" => $arMessage["TOPIC_INFO"]["TITLE"] . ($arMessage["NEW_TOPIC"] == "Y" && !empty($arMessage["TOPIC_INFO"]["DESCRIPTION"]) ? ", " . $arMessage["TOPIC_INFO"]["DESCRIPTION"] : ""), "TAGS" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_INFO"]["TAGS"] : "", "BODY" => GetMessage("AVTOR_PREF") . " " . $arMessage["AUTHOR_NAME"] . ". " . forumTextParser::clearAllTags($arMessage["POST_MESSAGE"]), "ENTITY_TYPE_ID" => $arMessage["NEW_TOPIC"] == "Y" ? "FORUM_TOPIC" : "FORUM_POST", "ENTITY_ID" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_ID"] : $arMessage["ID"], "USER_ID" => $arMessage["AUTHOR_ID"], "URL" => "", "INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y");
// get mentions
$arMentionedUserID = CForumMessage::GetMentionedUserID($arMessage["POST_MESSAGE"]);
if (!empty($arMentionedUserID)) {
$arSearchInd["PARAMS"] = array("mentioned_user_id" => $arMentionedUserID);
}
$urlPatterns = array("FORUM_ID" => $arMessage["FORUM_ID"], "TOPIC_ID" => $arMessage["TOPIC_ID"], "TITLE_SEO" => $arMessage["TOPIC_INFO"]["TITLE_SEO"], "MESSAGE_ID" => $arMessage["ID"], "SOCNET_GROUP_ID" => $arMessage["TOPIC_INFO"]["SOCNET_GROUP_ID"], "OWNER_ID" => $arMessage["TOPIC_INFO"]["OWNER_ID"], "PARAM1" => $arMessage["PARAM1"], "PARAM2" => $arMessage["PARAM2"]);
foreach ($arParams["SITE"] as $key => $val) {
$arSearchInd["LID"][$key] = CForumNew::PreparePath2Message($val, $urlPatterns);
if (empty($arSearchInd["URL"]) && !empty($arSearchInd["LID"][$key])) {
$arSearchInd["URL"] = $arSearchInd["LID"][$key];
}
}
if (empty($arSearchInd["URL"])) {
foreach ($arParams["SITE"] as $key => $val) {
$db_lang = CLang::GetByID($key);
if ($db_lang && ($ar_lang = $db_lang->Fetch())) {
$arParams["DEFAULT_URL"] = $ar_lang["DIR"];
break;
}
}
$arParams["DEFAULT_URL"] .= COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
$arSearchInd["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"], $urlPatterns);
}
CSearch::DeleteIndex("forum", $ID);
CSearch::Index("forum", $ID, $arSearchInd, true);
}
示例3: OnReindex
function OnReindex($NS = array(), $oCallback = NULL, $callback_method = "")
{
global $DB;
$arResultAll = array();
$arParams = array("PERMISSION" => array(), "SITE" => array(), "DEFAULT_URL" => array());
$search_message_count = intVal(COption::GetOptionInt("forum", "search_message_count", 0));
$strNSJoin = "";
$strFilter = "";
if ($NS["MODULE"] == "forum" && intVal($NS["ID"]) > 0 && intVal($NS["CNT"]) > 0) {
$strFilter = " AND (FM.ID>" . intVal($NS["ID"]) . ") ";
} elseif ($NS["MODULE"] == "forum" && intVal($NS["ID"]) > 0) {
// out of date
$strFilter = " AND (FM.ID>=" . intVal($NS["ID"]) . ") ";
}
if ($NS["SITE_ID"] != "") {
$strNSJoin .= " INNER JOIN b_forum2site FS ON (FS.FORUM_ID=F.ID) ";
$strFilter .= " AND FS.SITE_ID='" . $DB->ForSQL($NS["SITE_ID"]) . "' ";
}
$strSql = "SELECT STRAIGHT_JOIN FT.ID as TID, FM.ID as MID, FM.ID as ID, FT.FORUM_ID, FT.TITLE, " . CForumNew::Concat("-", array("FT.ID", "FT.TITLE_SEO")) . " as TITLE_SEO,\n\t\t\t\tFT.DESCRIPTION, FT.TAGS, FT.HTML as FT_HTML,\n\t\t\t\tFM.PARAM1, FM.PARAM2, FM.POST_MESSAGE, FM.POST_MESSAGE_FILTER, FM.POST_MESSAGE_HTML, FM.AUTHOR_NAME, FM.AUTHOR_ID, FM.NEW_TOPIC,\n\t\t\t\t" . $DB->DateToCharFunction("FM.POST_DATE") . " as POST_DATE, " . $DB->DateToCharFunction("FM.EDIT_DATE") . " as EDIT_DATE, FT.SOCNET_GROUP_ID, FT.OWNER_ID\n\t\t\tFROM b_forum_message FM use index (PRIMARY), b_forum_topic FT, b_forum F\n\t\t\t" . $strNSJoin . "\n\t\t\tWHERE (FM.TOPIC_ID = FT.ID) AND (F.ID = FT.FORUM_ID) AND (F.INDEXATION = 'Y') AND (FM.APPROVED = 'Y')\n\t\t\t" . $strFilter . "\n\t\t\tORDER BY FM.ID";
if ($search_message_count > 0) {
$strSql .= " LIMIT 0, " . $search_message_count;
}
$db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($db_res && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$db_res = new _CMessageDBResult($db_res);
}
$rownum = 0;
while ($res = $db_res->Fetch()) {
$rownum++;
if (empty($arParams["PERMISSION"][$res["FORUM_ID"]])) {
$arGroups = CForumNew::GetAccessPermissions($res["FORUM_ID"]);
$arParams["PERMISSION"][$res["FORUM_ID"]] = array();
for ($i = 0; $i < count($arGroups); $i++) {
if ($arGroups[$i][1] >= "E") {
$arParams["PERMISSION"][$res["FORUM_ID"]][] = $arGroups[$i][0];
if ($arGroups[$i][0] == 2) {
break;
}
}
}
}
if (empty($arParams["SITE"][$res["FORUM_ID"]])) {
$arParams["SITE"][$res["FORUM_ID"]] = CForumNew::GetSites($res["FORUM_ID"]);
}
$arResult = array("ID" => $res["MID"], "LID" => array(), "LAST_MODIFIED" => !empty($res["EDIT_DATE"]) ? $res["EDIT_DATE"] : $res["POST_DATE"], "PARAM1" => $res["FORUM_ID"], "PARAM2" => $res["TID"], "USER_ID" => $res["AUTHOR_ID"], "ENTITY_TYPE_ID" => $res["NEW_TOPIC"] == "Y" ? "FORUM_TOPIC" : "FORUM_POST", "ENTITY_ID" => $res["NEW_TOPIC"] == "Y" ? $res["TID"] : $res["MID"], "PERMISSIONS" => $arParams["PERMISSION"][$res["FORUM_ID"]], "TITLE" => $res["TITLE"] . ($res["NEW_TOPIC"] == "Y" && !empty($res["DESCRIPTION"]) ? ", " . $res["DESCRIPTION"] : ""), "TAGS" => $res["NEW_TOPIC"] == "Y" ? $res["TAGS"] : "", "BODY" => GetMessage("AVTOR_PREF") . " " . $res["AUTHOR_NAME"] . ". " . forumTextParser::clearAllTags(COption::GetOptionString("forum", "FILTER", "Y") != "Y" ? $res["POST_MESSAGE"] : $res["POST_MESSAGE_FILTER"]), "URL" => "", "INDEX_TITLE" => $res["NEW_TOPIC"] == "Y");
foreach ($arParams["SITE"][$res["FORUM_ID"]] as $key => $val) {
$arResult["LID"][$key] = CForumNew::PreparePath2Message($val, array("FORUM_ID" => $res["FORUM_ID"], "TOPIC_ID" => $res["TID"], "TITLE_SEO" => $res["TITLE_SEO"], "MESSAGE_ID" => $res["MID"], "SOCNET_GROUP_ID" => $res["SOCNET_GROUP_ID"], "OWNER_ID" => $res["OWNER_ID"], "PARAM1" => $res["PARAM1"], "PARAM2" => $res["PARAM2"]));
if (empty($arResult["URL"]) && !empty($arResult["LID"][$key])) {
$arResult["URL"] = $arResult["LID"][$key];
}
}
if (empty($arResult["URL"])) {
if (empty($arParams["DEFAULT_URL"][$res["FORUM_ID"]])) {
$arParams["DEFAULT_URL"][$res["FORUM_ID"]] = "/";
foreach ($arParams["SITE"][$res["FORUM_ID"]] as $key => $val) {
$db_lang = CLang::GetByID($key);
if ($db_lang && ($ar_lang = $db_lang->Fetch())) {
$arParams["DEFAULT_URL"][$res["FORUM_ID"]] = $ar_lang["DIR"];
break;
}
}
$arParams["DEFAULT_URL"][$res["FORUM_ID"]] .= COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
}
$arResult["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"][$res["FORUM_ID"]], array("FORUM_ID" => $res["FORUM_ID"], "TOPIC_ID" => $res["TID"], "MESSAGE_ID" => $res["MID"], "SOCNET_GROUP_ID" => $res["SOCNET_GROUP_ID"], "OWNER_ID" => $res["OWNER_ID"], "PARAM1" => $res["PARAM1"], "PARAM2" => $res["PARAM2"]));
}
if ($oCallback) {
$resCall = call_user_func(array($oCallback, $callback_method), $arResult);
if (!$resCall) {
return $arResult["ID"];
}
} else {
$arResultAll[] = $arResult;
}
}
if ($oCallback && $search_message_count > 0 && $rownum >= $search_message_count - 1) {
return $arResult["ID"];
}
if ($oCallback) {
return false;
}
return $arResultAll;
}