本文整理汇总了PHP中HTMLToTxt函数的典型用法代码示例。如果您正苦于以下问题:PHP HTMLToTxt函数的具体用法?PHP HTMLToTxt怎么用?PHP HTMLToTxt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLToTxt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cutText
/**
* Обрезка текста последним пробелом с добавлнием троеточия
* @param strign $text Большой текст для обрезки
* @param integer $size Максимальный размер обрезанного текста
* @return strging Обрезанный текст
*/
public function cutText($text, $size = 150)
{
if (strlen($text) > $size) {
$text = substr(\HTMLToTxt($text), 0, strripos(substr(\HTMLToTxt($text), 0, $size), " ")) . "...";
}
return $text;
}
示例2: cut
public function cut($text, $size = false)
{
if (!$size)
{
$size = self::DEFAULT_SUBSTR_PREVIEW_TEXT;
}
if ($text)
{
// $text = \phpQuery::newDocumentHTML($text)->text();
return "      " . substr(\HTMLToTxt($text), 0, strripos(substr(HTMLToTxt($text), 0, $size), " ")) . "...";
}
else
{
throw new \Exception("Unexpected text to cut in " . __CLASS__, 1);
}
}
示例3: formatValuePrintable
/**
* @param FieldType $fieldType
* @param $value
* @return string
*/
protected static function formatValuePrintable(FieldType $fieldType, $value)
{
if (isset($value['VALUE'])) {
$value = $value['VALUE'];
}
if (isset($value['TEXT'])) {
$value = $value['TEXT'];
}
return HTMLToTxt(htmlspecialcharsback((string) $value));
}
示例4: formatValuePrintable
/**
* @param FieldType $fieldType
* @param $value
* @return string
*/
protected static function formatValuePrintable(FieldType $fieldType, $value)
{
$userType = static::getUserType($fieldType);
if (!isset($value['VALUE'])) {
$value = array('VALUE' => $value);
}
if (!empty($userType['GetPublicViewHTML'])) {
$result = call_user_func_array($userType['GetPublicViewHTML'], array(array('LINK_IBLOCK_ID' => $fieldType->getOptions()), $value, ''));
return HTMLToTxt($result);
}
return parent::formatValuePrintable($fieldType, $value);
}
示例5: NotifyError
private function NotifyError()
{
if ($this->arExternalSale == null) {
$this->arExternalSale = CCrmExternalSale::GetDefaultSettings($this->externalSaleId);
}
if (intval($this->arExternalSale["GROUP_ID"]) <= 0) {
return true;
}
static $isSNIncluded = null;
if ($isSNIncluded === null) {
$isSNIncluded = CModule::IncludeModule("socialnetwork");
}
if (!$isSNIncluded) {
return;
}
$ar = array("#NAME#" => $this->arExternalSale["NAME"], "#URL#" => "/crm/configs/external_sale/", "#DATE#" => date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), time()));
$message = GetMessage("CRM_GCES_NOTIFY_ERROR_MESSAGE", $ar);
$arFields = array("EVENT_ID" => "crm_10_errors", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => "SYSTEM MESSAGE", "TITLE" => GetMessage("CRM_GCES_NOTIFY_ERROR_TITLE", array("#NAME#" => $this->arExternalSale["NAME"])), "MESSAGE" => $message, "TEXT_MESSAGE" => HTMLToTxt($message), "MODULE_ID" => "crm", "CALLBACK_FUNC" => false, "SOURCE_ID" => false, "ENABLE_COMMENTS" => "Y", "ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $this->arExternalSale["GROUP_ID"], "URL" => "");
$logId = CSocNetLog::Add($arFields, false);
if (intval($logId) > 0) {
$arPerms = array("SG" . $this->arExternalSale["GROUP_ID"], "SG" . $this->arExternalSale["GROUP_ID"] . "_A", "SG" . $this->arExternalSale["GROUP_ID"] . "_E", "SG" . $this->arExternalSale["GROUP_ID"] . "_K");
CSocNetLog::Update($logId, array("TMP_ID" => $logId));
CSocNetLogRights::Add($logId, $arPerms);
CSocNetLog::SendEvent($logId, "SONET_NEW_EVENT", $logId);
return $logId;
}
if (($ex = $GLOBALS["APPLICATION"]->GetException()) !== false) {
$this->AddError($ex->GetID(), $ex->GetString());
} else {
$this->AddError("CDA", "Notify error");
}
return false;
}
示例6: nl2br
<?php
if (CSalePaySystemAction::GetParamValue("COMMENT1", false)) {
?>
<?php
echo nl2br(HTMLToTxt(preg_replace(array('#</div>\\s*<div[^>]*>#i', '#</?div>#i'), array('<br>', '<br>'), htmlspecialcharsback(CSalePaySystemAction::GetParamValue("COMMENT1", false))), '', array(), 0));
?>
<br>
<br>
<?php
}
?>
<?php
if (CSalePaySystemAction::GetParamValue("COMMENT2", false)) {
?>
<?php
echo nl2br(HTMLToTxt(preg_replace(array('#</div>\\s*<div[^>]*>#i', '#</?div>#i'), array('<br>', '<br>'), htmlspecialcharsback(CSalePaySystemAction::GetParamValue("COMMENT2", false))), '', array(), 0));
?>
<br>
<br>
<?php
}
}
?>
<br>
<br>
<br>
<?php
$bankAccNo = CSalePaySystemAction::GetParamValue("SELLER_BANK_ACCNO", false);
$bankRouteNo = CSalePaySystemAction::GetParamValue("SELLER_BANK_ROUTENO", false);
示例7: Update
//.........这里部分代码省略.........
}
$ipropTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($ar_element["IBLOCK_ID"], $ar_element["ID"]);
if (array_key_exists("PREVIEW_PICTURE", $arFields) && is_array($arFields["PREVIEW_PICTURE"])) {
if (strlen($arFields["PREVIEW_PICTURE"]["name"]) <= 0 && strlen($arFields["PREVIEW_PICTURE"]["del"]) <= 0 && !is_set($arFields["PREVIEW_PICTURE"], "description")) {
unset($arFields["PREVIEW_PICTURE"]);
} else {
$arFields["PREVIEW_PICTURE"]["MODULE_ID"] = "iblock";
$arFields["PREVIEW_PICTURE"]["old_file"] = $ar_wf_element["PREVIEW_PICTURE"];
$arFields["PREVIEW_PICTURE"]["name"] = \Bitrix\Iblock\Template\Helper::makeFileName($ipropTemplates, "ELEMENT_PREVIEW_PICTURE_FILE_NAME", array_merge($ar_element, $arFields), $arFields["PREVIEW_PICTURE"]);
}
}
if (array_key_exists("DETAIL_PICTURE", $arFields) && is_array($arFields["DETAIL_PICTURE"])) {
if (strlen($arFields["DETAIL_PICTURE"]["name"]) <= 0 && strlen($arFields["DETAIL_PICTURE"]["del"]) <= 0 && !is_set($arFields["DETAIL_PICTURE"], "description")) {
unset($arFields["DETAIL_PICTURE"]);
} else {
$arFields["DETAIL_PICTURE"]["MODULE_ID"] = "iblock";
$arFields["DETAIL_PICTURE"]["old_file"] = $ar_wf_element["DETAIL_PICTURE"];
$arFields["DETAIL_PICTURE"]["name"] = \Bitrix\Iblock\Template\Helper::makeFileName($ipropTemplates, "ELEMENT_DETAIL_PICTURE_FILE_NAME", array_merge($ar_element, $arFields), $arFields["DETAIL_PICTURE"]);
}
}
if (is_set($arFields, "DATE_ACTIVE_FROM")) {
$arFields["ACTIVE_FROM"] = $arFields["DATE_ACTIVE_FROM"];
}
if (is_set($arFields, "DATE_ACTIVE_TO")) {
$arFields["ACTIVE_TO"] = $arFields["DATE_ACTIVE_TO"];
}
if (is_set($arFields, "EXTERNAL_ID")) {
$arFields["XML_ID"] = $arFields["EXTERNAL_ID"];
}
$PREVIEW_tmp = is_set($arFields, "PREVIEW_TEXT") ? $arFields["PREVIEW_TEXT"] : $ar_wf_element["PREVIEW_TEXT"];
$PREVIEW_TYPE_tmp = is_set($arFields, "PREVIEW_TEXT_TYPE") ? $arFields["PREVIEW_TEXT_TYPE"] : $ar_wf_element["PREVIEW_TEXT_TYPE"];
$DETAIL_tmp = is_set($arFields, "DETAIL_TEXT") ? $arFields["DETAIL_TEXT"] : $ar_wf_element["DETAIL_TEXT"];
$DETAIL_TYPE_tmp = is_set($arFields, "DETAIL_TEXT_TYPE") ? $arFields["DETAIL_TEXT_TYPE"] : $ar_wf_element["DETAIL_TEXT_TYPE"];
$arFields["SEARCHABLE_CONTENT"] = ToUpper((is_set($arFields, "NAME") ? $arFields["NAME"] : $ar_wf_element["NAME"]) . "\r\n" . ($PREVIEW_TYPE_tmp == "html" ? HTMLToTxt($PREVIEW_tmp) : $PREVIEW_tmp) . "\r\n" . ($DETAIL_TYPE_tmp == "html" ? HTMLToTxt($DETAIL_tmp) : $DETAIL_tmp));
if (is_set($arFields["IBLOCK_SECTION_ID"]) && !is_set($arFields, "IBLOCK_SECTION")) {
$arFields["IBLOCK_SECTION"] = array($arFields["IBLOCK_SECTION_ID"]);
}
$arFields["IBLOCK_ID"] = $ar_element["IBLOCK_ID"];
if (!$this->CheckFields($arFields, $ID, $bCheckDiskQuota) || strlen($strWarning)) {
$this->LAST_ERROR .= $strWarning;
$Result = false;
$arFields["RESULT_MESSAGE"] =& $this->LAST_ERROR;
} else {
unset($arFields["ID"]);
if (array_key_exists("PREVIEW_PICTURE", $arFields)) {
$SAVED_PREVIEW_PICTURE = $arFields["PREVIEW_PICTURE"];
} else {
$SAVED_PREVIEW_PICTURE = false;
}
if (array_key_exists("DETAIL_PICTURE", $arFields)) {
$SAVED_DETAIL_PICTURE = $arFields["DETAIL_PICTURE"];
} else {
$SAVED_DETAIL_PICTURE = false;
}
// edit was done in workflow mode
if ($bWorkFlow) {
$arFields["WF_PARENT_ELEMENT_ID"] = $ID;
if (array_key_exists("PREVIEW_PICTURE", $arFields)) {
if (is_array($arFields["PREVIEW_PICTURE"])) {
if (strlen($arFields["PREVIEW_PICTURE"]["name"]) <= 0 && strlen($arFields["PREVIEW_PICTURE"]["del"]) <= 0) {
if (array_key_exists("description", $arFields["PREVIEW_PICTURE"])) {
$arFile = CFile::GetFileArray($ar_wf_element["PREVIEW_PICTURE"]);
if ($arFields["PREVIEW_PICTURE"]["description"] != $arFile["DESCRIPTION"]) {
//Description updated, so it's new file
$arNewFile = CFile::MakeFileArray($ar_wf_element["PREVIEW_PICTURE"]);
$arNewFile["description"] = $arFields["PREVIEW_PICTURE"]["description"];
示例8: GetDocument
public function GetDocument($documentId)
{
$documentId = intval($documentId);
if ($documentId <= 0) {
throw new CBPArgumentNullException("documentId");
}
$arResult = null;
$dbDocumentList = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y"));
if ($objDocument = $dbDocumentList->GetNextElement(false, true)) {
$arDocumentFields = $objDocument->GetFields();
$arDocumentProperties = $objDocument->GetProperties();
foreach ($arDocumentFields as $fieldKey => $fieldValue) {
if (substr($fieldKey, 0, 1) == "~") {
continue;
}
$arResult[$fieldKey] = $fieldValue;
if (in_array($fieldKey, array("MODIFIED_BY", "CREATED_BY"))) {
$arResult[$fieldKey] = "user_" . $fieldValue;
$arResult[$fieldKey . "_PRINTABLE"] = $arDocumentFields[$fieldKey == "MODIFIED_BY" ? "USER_NAME" : "CREATED_USER_NAME"];
} elseif (in_array($fieldKey, array("PREVIEW_TEXT", "DETAIL_TEXT"))) {
if ($arDocumentFields[$fieldKey . "_TYPE"] == "html") {
$arResult[$fieldKey] = HTMLToTxt($arDocumentFields["~" . $fieldKey]);
}
}
}
foreach ($arDocumentProperties as $propertyKey => $propertyValue) {
if (strlen($propertyValue["USER_TYPE"]) > 0) {
if ($propertyValue["USER_TYPE"] == "UserID" || $propertyValue["USER_TYPE"] == "employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
if (!is_array($propertyValue["VALUE"])) {
$db = CUser::GetByID($propertyValue["VALUE"]);
if ($ar = $db->GetNext()) {
$arResult["PROPERTY_" . $propertyKey] = "user_" . intval($propertyValue["VALUE"]);
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = "(" . $ar["LOGIN"] . ")" . (strlen($ar["NAME"]) > 0 || strlen($ar["LAST_NAME"]) > 0 ? " " : "") . CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $ar);
}
} else {
for ($i = 0, $cnt = count($propertyValue["VALUE"]); $i < $cnt; $i++) {
$db = CUser::GetByID($propertyValue["VALUE"][$i]);
if ($ar = $db->GetNext()) {
$arResult["PROPERTY_" . $propertyKey][] = "user_" . intval($propertyValue["VALUE"][$i]);
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$propertyValue["VALUE"][$i]] = "(" . $ar["LOGIN"] . ")" . (strlen($ar["NAME"]) > 0 || strlen($ar["LAST_NAME"]) > 0 ? " " : "") . CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $ar);
}
}
}
} else {
$arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
}
} elseif ($propertyValue["PROPERTY_TYPE"] == "L") {
$arPropertyValue = $propertyValue["VALUE"];
$arPropertyKey = $propertyValue["VALUE_XML_ID"];
if (!is_array($arPropertyValue)) {
$arPropertyValue = array($arPropertyValue);
$arPropertyKey = array($arPropertyKey);
}
for ($i = 0, $cnt = count($arPropertyValue); $i < $cnt; $i++) {
$arResult["PROPERTY_" . $propertyKey][$arPropertyKey[$i]] = $arPropertyValue[$i];
}
} elseif ($propertyValue["PROPERTY_TYPE"] == "F") {
if (!is_array($propertyValue["VALUE"])) {
if (intval($propertyValue["VALUE"]) > 0 && ($ar = CFile::GetFileArray($propertyValue["VALUE"]))) {
$arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $ar["SRC"];
}
} else {
for ($i = 0, $cnt = count($propertyValue["VALUE"]); $i < $cnt; $i++) {
if (intval($propertyValue["VALUE"][$i]) > 0 && ($ar = CFile::GetFileArray($propertyValue["VALUE"][$i]))) {
$arResult["PROPERTY_" . $propertyKey][] = $propertyValue["VALUE"][$i];
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$propertyValue["VALUE"][$i]] = $ar["SRC"];
}
}
}
} else {
$arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
}
}
}
return $arResult;
}
示例9: Add
//.........这里部分代码省略.........
unset($arFields["DETAIL_PICTURE"]);
}
}
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "PREVIEW_TEXT_TYPE") && $arFields["PREVIEW_TEXT_TYPE"] != "html") {
$arFields["PREVIEW_TEXT_TYPE"] = "text";
}
if (is_set($arFields, "DETAIL_TEXT_TYPE") && $arFields["DETAIL_TEXT_TYPE"] != "html") {
$arFields["DETAIL_TEXT_TYPE"] = "text";
}
if (is_set($arFields, "DATE_ACTIVE_FROM")) {
$arFields["ACTIVE_FROM"] = $arFields["DATE_ACTIVE_FROM"];
}
if (is_set($arFields, "DATE_ACTIVE_TO")) {
$arFields["ACTIVE_TO"] = $arFields["DATE_ACTIVE_TO"];
}
if (is_set($arFields, "EXTERNAL_ID")) {
$arFields["XML_ID"] = $arFields["EXTERNAL_ID"];
}
if ($bWorkFlow) {
$arFields["WF"] = "Y";
if ($arFields["WF_STATUS_ID"] != 1) {
$arFields["WF_NEW"] = "Y";
} else {
$arFields["WF_NEW"] = "";
}
}
$arFields["SEARCHABLE_CONTENT"] = $arFields["NAME"];
if (isset($arFields["PREVIEW_TEXT"])) {
if (isset($arFields["PREVIEW_TEXT_TYPE"]) && $arFields["PREVIEW_TEXT_TYPE"] == "html") {
$arFields["SEARCHABLE_CONTENT"] .= "\r\n" . HTMLToTxt($arFields["PREVIEW_TEXT"]);
} else {
$arFields["SEARCHABLE_CONTENT"] .= "\r\n" . $arFields["PREVIEW_TEXT"];
}
}
if (isset($arFields["DETAIL_TEXT"])) {
if (isset($arFields["DETAIL_TEXT_TYPE"]) && $arFields["DETAIL_TEXT_TYPE"] == "html") {
$arFields["SEARCHABLE_CONTENT"] .= "\r\n" . HTMLToTxt($arFields["DETAIL_TEXT"]);
} else {
$arFields["SEARCHABLE_CONTENT"] .= "\r\n" . $arFields["DETAIL_TEXT"];
}
}
$arFields["SEARCHABLE_CONTENT"] = ToUpper($arFields["SEARCHABLE_CONTENT"]);
if (!$this->CheckFields($arFields) || strlen($strWarning)) {
$this->LAST_ERROR .= $strWarning;
$Result = false;
$arFields["RESULT_MESSAGE"] =& $this->LAST_ERROR;
} else {
if (array_key_exists("PREVIEW_PICTURE", $arFields)) {
$SAVED_PREVIEW_PICTURE = $arFields["PREVIEW_PICTURE"];
if (is_array($arFields["PREVIEW_PICTURE"])) {
CFile::SaveForDB($arFields, "PREVIEW_PICTURE", "iblock");
}
if ($bWorkFlow) {
$COPY_PREVIEW_PICTURE = $arFields["PREVIEW_PICTURE"];
}
}
if (array_key_exists("DETAIL_PICTURE", $arFields)) {
$SAVED_DETAIL_PICTURE = $arFields["DETAIL_PICTURE"];
if (is_array($arFields["DETAIL_PICTURE"])) {
CFile::SaveForDB($arFields, "DETAIL_PICTURE", "iblock");
}
if ($bWorkFlow) {
示例10: ReindexGroupTasks
function ReindexGroupTasks($iblock_id, $path, $last_id)
{
if (!CModule::IncludeModule("iblock")) {
return false;
}
$arSections = array();
$rsElements = CIBlockElement::GetList(array("ID" => "asc"), array("IBLOCK_ID" => $iblock_id, ">ID" => intval($last_id), "CHECK_PERMISSIONS" => "N"), false, false, array("ID", "IBLOCK_ID", "IBLOCK_TYPE_ID", "NAME", "DETAIL_TEXT", "TAGS", "TIMESTAMP_X", "IBLOCK_SECTION_ID", "PROPERTY_FORUM_TOPIC_ID"));
while ($ar = $rsElements->Fetch()) {
if (!array_key_exists($ar["IBLOCK_SECTION_ID"], $arSections)) {
$rsPath = CIBlockSection::GetNavChain($ar["IBLOCK_ID"], $ar["IBLOCK_SECTION_ID"]);
$arSection = $rsPath->Fetch();
$arSections[$ar["IBLOCK_SECTION_ID"]] = intval($arSection["XML_ID"]);
}
$entity_id = $arSections[$ar["IBLOCK_SECTION_ID"]];
if ($entity_id) {
$url = str_replace(array("#group_id#", "#element_id#", "#task_id#", "#action#"), array($entity_id, $ar["ID"], $ar["ID"], "view"), $path);
$topic_id = intval($ar["PROPERTY_FORUM_TOPIC_ID_VALUE"]);
if ($topic_id) {
$this->UpdateForumTopicIndex($topic_id, "G", $entity_id, "tasks", "view", $this->Url($url, array("MID" => "#message_id#"), "message#message_id#"));
}
CSearch::Index("socialnetwork", $ar["ID"], array("LAST_MODIFIED" => $ar["TIMESTAMP_X"], "TITLE" => $ar["NAME"], "BODY" => $ar["DETAIL_TEXT_TYPE"] == "html" ? HTMLToTxt($ar["DETAIL_TEXT"]) : $ar["DETAIL_TEXT"], "SITE_ID" => array(SITE_ID => $url), "PARAM1" => $ar["IBLOCK_TYPE_ID"], "PARAM2" => $ar["IBLOCK_ID"], "PARAM3" => "tasks", "TAGS" => $ar["TAGS"], "PERMISSIONS" => $this->GetSearchGroups("G", $entity_id, 'tasks', 'view'), "PARAMS" => $this->GetSearchParams("G", $entity_id, 'tasks', 'view'), "REINDEX_FLAG" => true), true, $this->_sess_id);
$this->_counter++;
}
if ($this->_end_time && $this->_end_time <= time()) {
return $ar["ID"];
}
}
return false;
}
示例11: array
$taskId = (int) $_REQUEST['TASK_ID'];
$task = false;
if ($taskId > 0) {
$dbTask = CBPTaskService::GetList(array(), array("ID" => $taskId, "USER_ID" => $user->getId(), 'USER_STATUS' => CBPTaskUserStatus::Waiting), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS"));
$task = $dbTask->fetch();
}
if (!$task) {
$result['SUCCESS'] = false;
$result['ERROR'] = 'Task not found.';
} else {
$task["PARAMETERS"]["DOCUMENT_ID"] = CBPStateService::GetStateDocumentId($task['WORKFLOW_ID']);
$task["MODULE_ID"] = $task["PARAMETERS"]["DOCUMENT_ID"][0];
$task["ENTITY"] = $task["PARAMETERS"]["DOCUMENT_ID"][1];
$task["DOCUMENT_ID"] = $task["PARAMETERS"]["DOCUMENT_ID"][2];
$arErrorsTmp = array();
if (SITE_CHARSET != "utf-8" && !empty($_SERVER['HTTP_BX_AJAX'])) {
CUtil::decodeURIComponent($_REQUEST);
CUtil::decodeURIComponent($_FILES);
}
$formData = $_REQUEST + $_FILES;
if (!CBPDocument::PostTaskForm($task, $user->getId(), $formData, $arErrorsTmp)) {
$arError = array();
foreach ($arErrorsTmp as $e) {
$arError[] = array("id" => "bad_task", "text" => $e["message"]);
}
$e = new CAdminException($arError);
$result['ERROR'] = HTMLToTxt($e->GetString());
}
}
}
echo CUtil::PhpToJSObject($result);
示例12: WriteWordsInTable
/**
* @deprecated
*/
static function WriteWordsInTable($M_ID, $SITE_ID, $s)
{
global $DB;
if (!self::CheckModule()) {
return;
}
$err_mess = self::err_mess() . "<br>Function: writeWordsInTable<br>Line: ";
$M_ID = intval($M_ID);
$ticketSearch = self::TABLE_NAME;
$rsSite = CSite::GetByID($SITE_ID);
$arrSite = $rsSite->Fetch();
$langID = $arrSite["LANGUAGE_ID"];
$DB->Query("DELETE FROM {$ticketSearch} WHERE MESSAGE_ID = {$M_ID}", false, $err_mess . __LINE__);
$res = stemming(HTMLToTxt($s), $langID);
foreach ($res as $key => $val) {
$strSql = "INSERT INTO " . $ticketSearch . "(MESSAGE_ID, SEARCH_WORD) VALUES ({$M_ID}, '" . $DB->ForSql($key) . "')";
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
//$DB->Insert($ticketSearch, array("MESSAGE_ID" => $M_ID, "SEARCH_WORD" => "'" . $DB->ForSql($key) . "'"), $err_mess . __LINE__);
}
}
示例13: find_creat_album
public function find_creat_album($SectionID, $arFields, $arELFields=array()) {
if( !isset($SectionID) || empty($SectionID) || !is_array($arFields) ):
return false;
endif;
global $APPLICATION;
$MODULE_ID = "kreattika.shopvk";
$VKOwnerID = COption::GetOptionString($MODULE_ID, "shop_vk_owner_id", "N");
$AlbumVKEventLog = COption::GetOptionString($MODULE_ID, "shop_vk_album_event_log", "N");
$TableNameAlbums = "b_shopvk_albums";
$lfEventExist = false;
$arDBAlbumFilter=array("ACTIVE"=>'\'Y\'', "VK_OWNER_ID"=>intval($VKOwnerID), "IBLOCK_ID"=>intval($arFields["IBLOCK_ID"]), "SECTION_ID"=>intval($SectionID));
$obDBAlbumResult = CSVKDataBlock::GetList($TableNameAlbums, $arDBAlbumFilter);
if ($arDBAlbumResult = $obDBAlbumResult->Fetch()) :
$AlbumVKID = $arDBAlbumResult["VK_ALBUM_ID"];
$DBAlbumItemID = $arDBAlbumResult["ID"];
return intval($AlbumVKID);
else:
if(CModule::IncludeModule("iblock")):
$obSection = CIBlockSection::GetByID($SectionID);
if($arSection = $obSection->Fetch()):
$AlbumVKID = ShopVK::create_album($arSection['NAME'], HTMLToTxt($arSection['DESCRIPTION']), 'N');
$AlbumVKID = intval($AlbumVKID);
$arDBAlbumFields = array(
"ACTIVE"=>"Y",
"CREATED"=>ConvertTimeStamp(time(), "FULL", $arElFields['LID']),
"SITE_ID"=>$arElFields['LID'],
"IBLOCK_ID"=>intval($arFields['IBLOCK_ID']),
"SECTION_ID"=>intval($arSection['ID']),
"SECTION_NAME"=>trim($arSection['NAME']),
"VK_OWNER_ID"=>intval($VKOwnerID),
"VK_ALBUM_ID"=>intval($AlbumVKID),
"VK_ALBUM_NAME"=>trim($arSection['NAME']),
"VK_ALBUM_CAPTION"=>HTMLToTxt($arSection['DESCRIPTION']),
);
CSVKDataBlock::Add($TableNameAlbums, $arDBAlbumFields);
$EventLogDesc = 'New VKAlbumID: '.$AlbumVKID.', for SectionID: '.$arSection['ID'].', '.$arSection['NAME'];
$lfEventExist = true;
return intval($AlbumVKID);
else:
return false;
endif;
else:
return false;
endif;
endif;
if($AlbumVKEventLog=='Y' && $lfEventExist):
CEventLog::Add(array(
"SEVERITY" => "SECURITY",
"AUDIT_TYPE_ID" => "SHOP_VK_AUTOEX_ALBUM",
"MODULE_ID" => $MODULE_ID,
"ITEM_ID" => $arFields['ID'],
"DESCRIPTION" => $EventLogDesc,
));
endif;
}
示例14: array
$arCacheID = array($arParams['FID'], $arParams['TID']);
$cache_id = "forum_topic_desc_".md5(serialize($arCacheID));
if ($cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path))
{
$descRes = $cache->GetVars();
$description = $descRes["Description"];
}
if ($description == '')
{
$db_res = CForumMessage::GetListEx(array("ID" => "ASC"), array("TOPIC_ID" => $arParams["TID"]), 0, 1);
if ($db_res && $arRes = $db_res->GetNext())
{
$description = HTMLToTxt($parser->convert($arRes['POST_MESSAGE'], $arAllow),'', array(
"/(<img\s.*?src\s*=\s*)([\"']?)(\\/.*?)(\\2)(\s.+?>|\s*>)/is", // from HTMLToTxt
"/(<img\s.*?src\s*=\s*)([\"']?)(.*?)(\\2)(\s.+?>|\s*>)/is",
"/(<a\s.*?href\s*=\s*)([\"']?)(\\/.*?)(\\2)(.*?>)(.*?)<\\/a>/is",
"/(<a\s.*?href\s*=\s*)([\"']?)(.*?)(\\2)(.*?>)(.*?)<\\/a>/is",
));
$description = str_replace(array("\r", "\n"), "", $description);
if (strlen($description) > 512)
{
$description = substr($description,0,512);
$rSpace = strrpos($description, ' ');
if ($rSpace !== false)
$description = substr($description, 0, $rSpace).'...';
}
}
if (($description != '') && ($arParams["CACHE_TIME"] > 0))
{
$cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
示例15: HTMLToTxt
}
$pdf->Line(!is_null($arCells[$n][1]) ? $x0 : $x6, $y5, $x7, $y5);
}
$pdf->Ln();
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont($fontFamily, 'B', $fontSize);
if (CSalePaySystemAction::GetParamValue("COMMENT1", false) || CSalePaySystemAction::GetParamValue("COMMENT2", false)) {
$pdf->SetFont($fontFamily, '', $fontSize);
if (CSalePaySystemAction::GetParamValue("COMMENT1", false)) {
$pdf->Write(15, HTMLToTxt(preg_replace(array('#</div>\\s*<div[^>]*>#i', '#</?div>#i'), array('<br>', '<br>'), CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("COMMENT1", false))), '', array(), 0));
$pdf->Ln();
$pdf->Ln();
}
if (CSalePaySystemAction::GetParamValue("COMMENT2", false)) {
$pdf->Write(15, HTMLToTxt(preg_replace(array('#</div>\\s*<div[^>]*>#i', '#</?div>#i'), array('<br>', '<br>'), CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("COMMENT2", false))), '', array(), 0));
$pdf->Ln();
$pdf->Ln();
}
}
$pdf->Ln();
if (!$blank && CSalePaySystemAction::GetParamValue('PATH_TO_STAMP', false)) {
list($stampHeight, $stampWidth) = $pdf->GetImageSize(CSalePaySystemAction::GetParamValue('PATH_TO_STAMP', false));
if ($stampHeight && $stampWidth) {
if ($stampHeight > 120 || $stampWidth > 120) {
$ratio = 120 / max($stampHeight, $stampWidth);
$stampHeight = $ratio * $stampHeight;
$stampWidth = $ratio * $stampWidth;
}
$pdf->Image(CSalePaySystemAction::GetParamValue('PATH_TO_STAMP', false), $margin['left'] + 40, $pdf->GetY(), $stampWidth, $stampHeight);
}