本文整理汇总了PHP中CRatingsComponentsMain类的典型用法代码示例。如果您正苦于以下问题:PHP CRatingsComponentsMain类的具体用法?PHP CRatingsComponentsMain怎么用?PHP CRatingsComponentsMain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRatingsComponentsMain类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __AssembleConfigDefault
public static function __AssembleConfigDefault($objectType = null)
{
$arConfigs = array();
$arRatingConfigs = CRatingsComponentsMain::OnGetRatingConfigs();
if (is_null($objectType)) {
foreach ($arRatingConfigs["COMPONENT"] as $OBJ_TYPE => $TYPE_VALUE) {
foreach ($TYPE_VALUE as $RAT_TYPE => $RAT_VALUE) {
foreach ($RAT_VALUE as $VALUE_CONFIG) {
foreach ($VALUE_CONFIG['FIELDS'] as $VALUE_FIELDS) {
$arConfigs[$OBJ_TYPE][$RAT_TYPE][$VALUE_CONFIG['ID']][$VALUE_FIELDS['ID']]['DEFAULT'] = $VALUE_FIELDS['DEFAULT'];
}
}
}
}
} else {
foreach ($arRatingConfigs["COMPONENT"][$objectType] as $RAT_TYPE => $RAT_VALUE) {
foreach ($RAT_VALUE as $VALUE_CONFIG) {
foreach ($VALUE_CONFIG['FIELDS'] as $VALUE_FIELDS) {
$arConfigs[$RAT_TYPE][$VALUE_CONFIG['ID']][$VALUE_FIELDS['ID']]['DEFAULT'] = $VALUE_FIELDS['DEFAULT'];
}
}
}
}
return $arConfigs;
}
开发者ID:rasuldev,项目名称:torino,代码行数:25,代码来源:ratings_components.php
示例2: ShowError
if (!CModule::IncludeModule("blog")) {
ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL"));
return;
}
$arParams["MESSAGE_COUNT"] = IntVal($arParams["MESSAGE_COUNT"]) > 0 ? IntVal($arParams["MESSAGE_COUNT"]) : 6;
$arParams["PREVIEW_WIDTH"] = IntVal($arParams["PREVIEW_WIDTH"]) > 0 ? IntVal($arParams["PREVIEW_WIDTH"]) : 100;
$arParams["PREVIEW_HEIGHT"] = IntVal($arParams["PREVIEW_HEIGHT"]) > 0 ? IntVal($arParams["PREVIEW_HEIGHT"]) : 100;
$arParams["SORT_BY1"] = strlen($arParams["SORT_BY1"]) > 0 ? $arParams["SORT_BY1"] : "DATE_PUBLISH";
$arParams["SORT_ORDER1"] = strlen($arParams["SORT_ORDER1"]) > 0 ? $arParams["SORT_ORDER1"] : "DESC";
$arParams["SORT_BY2"] = strlen($arParams["SORT_BY2"]) > 0 ? $arParams["SORT_BY2"] : "ID";
$arParams["SORT_ORDER2"] = strlen($arParams["SORT_ORDER2"]) > 0 ? $arParams["SORT_ORDER2"] : "DESC";
$arParams["MESSAGE_LENGTH"] = IntVal($arParams["MESSAGE_LENGTH"]) > 0 ? $arParams["MESSAGE_LENGTH"] : 100;
$arParams["BLOG_URL"] = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($arParams["BLOG_URL"]));
$arParams["USE_SOCNET"] = $arParams["USE_SOCNET"] == "Y" ? "Y" : "N";
// activation rating
CRatingsComponentsMain::GetShowRating($arParams);
CpageOption::SetOptionString("main", "nav_page_in_session", "N");
if (!is_array($arParams["GROUP_ID"])) {
$arParams["GROUP_ID"] = array($arParams["GROUP_ID"]);
}
foreach ($arParams["GROUP_ID"] as $k => $v) {
if (IntVal($v) <= 0) {
unset($arParams["GROUP_ID"][$k]);
}
}
if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
} else {
$arParams["CACHE_TIME"] = 0;
}
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例3: AddLiveComment
function AddLiveComment($commentId = 0, $path = "", $arParams = array())
{
if (IntVal($commentId) <= 0) {
return;
}
if (CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus() && ($arComment = CBlogComment::GetByID($commentId)) && ($arPost = CBlogPost::GetByID($arComment["POST_ID"]))) {
if (strlen($path) <= 0 && strlen($arComment["PATH"]) > 0) {
$path = CComponentEngine::MakePathFromTemplate($arComment["PATH"], array("post_id" => $arComment["POST_ID"], "comment_id" => $commentId));
}
if (strlen($path) <= 0) {
$path = CComponentEngine::MakePathFromTemplate($arPost["PATH"], array("post_id" => $arComment["POST_ID"], "comment_id" => $commentId)) . "?commentId=" . $commentId;
}
$arFormatParams = array("PATH_TO_USER" => isset($arParams["PATH_TO_USER"]) ? $arParams["PATH_TO_USER"] : '', "PATH_TO_POST" => $path, "NAME_TEMPLATE" => isset($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat(), "SHOW_LOGIN" => isset($arParams["SHOW_LOGIN"]) ? $arParams["SHOW_LOGIN"] : true, "AVATAR_SIZE_COMMENT" => isset($arParams["AVATAR_SIZE_COMMENT"]) ? $arParams["AVATAR_SIZE_COMMENT"] : 58, "PATH_TO_SMILE" => isset($arParams["PATH_TO_SMILE"]) ? $arParams["PATH_TO_SMILE"] : '', "DATE_TIME_FORMAT" => isset($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] : '', "SHOW_RATING" => isset($arParams["SHOW_RATING"]) ? $arParams["SHOW_RATING"] : '', "RATING_TYPE" => "like");
$arComment["DateFormated"] = FormatDateFromDB($arComment["DATE_CREATE"], $arFormatParams["DATE_TIME_FORMAT"], true);
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$arComment["DateFormated"] = ToLower($arComment["DateFormated"]);
}
$arComment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_COMMENT", $commentId, LANGUAGE_ID);
$arAuthor = CBlogUser::GetUserInfo($arComment["AUTHOR_ID"], $arFormatParams["PATH_TO_USER"], array("AVATAR_SIZE_COMMENT" => $arFormatParams["AVATAR_SIZE_COMMENT"]));
if (IsModuleInstalled('extranet') && CModule::IncludeModule('socialnetwork')) {
CSocNetTools::InitGlobalExtranetArrays();
}
$arTmpUser = array("NAME" => $arAuthor["~NAME"], "LAST_NAME" => $arAuthor["~LAST_NAME"], "SECOND_NAME" => $arAuthor["~SECOND_NAME"], "LOGIN" => $arAuthor["~LOGIN"], "NAME_LIST_FORMATTED" => "");
$arAuthor["NAME_FORMATED"] = CUser::FormatName($arFormatParams["NAME_TEMPLATE"], $arTmpUser, $arFormatParams["SHOW_LOGIN"] != "N");
if (intval($arAuthor["PERSONAL_PHOTO"]) > 0) {
$image_resize = CFile::ResizeImageGet($arAuthor["PERSONAL_PHOTO"], array("width" => $arFormatParams["AVATAR_SIZE_COMMENT"], "height" => $arFormatParams["AVATAR_SIZE_COMMENT"]), BX_RESIZE_IMAGE_EXACT);
$arAuthor["PERSONAL_PHOTO_RESIZED"] = array("src" => $image_resize["src"]);
}
$p = new blogTextParser(false, '');
$ufCode = "UF_BLOG_COMMENT_FILE";
if (is_array($arComment["UF"][$ufCode])) {
$p->arUserfields = array($ufCode => array_merge($arComment["UF"][$ufCode], array("TAG" => "DOCUMENT ID")));
}
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "SHORT_ANCHOR" => "Y");
$arParserParams = array("imageWidth" => 800, "imageHeight" => 800);
$arComment["TextFormated"] = $p->convert($arComment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
$p->bMobile = true;
$arComment["TextFormatedMobile"] = $p->convert($arComment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
if ($perm >= BLOG_PERMS_MODERATE) {
if ($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$arComment["CAN_HIDE"] = "Y";
} else {
$arComment["CAN_SHOW"] = "Y";
}
} else {
$arComment["CAN_SHOW"] = $arComment["CAN_HIDE"] = "N";
}
$urlToPost = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arFormatParams["PATH_TO_POST"]), array("post_id" => "#source_post_id#", "user_id" => $arPost["AUTHOR_ID"]));
$urlToPost .= strpos($urlToPost, "?") !== false ? "&" : "?";
$arUrl = array("LINK" => $urlToPost, "SHOW" => $urlToPost . "show_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "HIDE" => $urlToPost . "hide_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "DELETE" => $urlToPost . "delete_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "USER" => htmlspecialcharsback($arFormatParams["PATH_TO_USER"]));
CRatingsComponentsMain::GetShowRating($arFormatParams);
if ($arFormatParams["SHOW_RATING"] == "Y") {
$arRating = CRatings::GetRatingVoteResult('BLOG_COMMENT', array($arComment["ID"]));
}
$arCommentParams = array("ID" => $commentId, "ENTITY_XML_ID" => "BLOG_" . $arPost["ID"], "FULL_ID" => array("BLOG_" . $arPost["ID"], $commentId), "ACTION" => "REPLY", "APPROVED" => "Y", "PANELS" => array("EDIT" => "N", "MODERATE" => "N", "DELETE" => "N"), "NEW" => "Y", "AUTHOR" => array("ID" => $GLOBALS["USER"]->GetID(), "NAME" => $arAuthor["NAME_FORMATED"], "URL" => $arAuthor["url"], "E-MAIL" => $arComment["AuthorEmail"], "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"], "IS_EXTRANET" => is_array($GLOBALS["arExtranetUserID"]) && in_array($GLOBALS["USER"]->GetID(), $GLOBALS["arExtranetUserID"])), "POST_TIMESTAMP" => $arComment["DATE_CREATE_TS"], "POST_TIME" => $arComment["DATE_CREATE_TIME"], "POST_DATE" => $arComment["DateFormated"], "POST_MESSAGE_TEXT" => $arComment["TextFormated"], "POST_MESSAGE_TEXT_MOBILE" => $arComment["TextFormatedMobile"], "URL" => array("LINK" => str_replace(array("##comment_id#", "#comment_id#"), array("", $commentId), $arUrl["LINK"]), "EDIT" => "__blogEditComment('" . $commentId . "', '" . $arPost["ID"] . "');", "MODERATE" => str_replace(array("#source_post_id#", "#post_id#", "#comment_id#", "&" . bitrix_sessid_get()), array($arPost["ID"], $arPost["ID"], $commentId, ""), $arComment["CAN_SHOW"] == "Y" ? $arUrl["SHOW"] : ($arComment["CAN_HIDE"] == "Y" ? $arUrl["HIDE"] : "")), "DELETE" => str_replace(array("#source_post_id#", "#post_id#", "#comment_id#", "&" . bitrix_sessid_get()), array($arPost["ID"], $arPost["ID"], $commentId, ""), $arUrl["DELETE"])), "AFTER" => "", "BEFORE_ACTIONS_MOBILE" => "", "AFTER_MOBILE" => "");
if ($arFormatParams["SHOW_RATING"] == "Y") {
$arRatingData = array("ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $commentId, "OWNER_ID" => $arComment["AUTHOR_ID"], "USER_VOTE" => $arRating[$commentId]["USER_VOTE"], "USER_HAS_VOTED" => $arRating[$commentId]["USER_HAS_VOTED"], "TOTAL_VOTES" => $arRating[$commentId]["TOTAL_VOTES"], "TOTAL_POSITIVE_VOTES" => $arRating[$commentId]["TOTAL_POSITIVE_VOTES"], "TOTAL_NEGATIVE_VOTES" => $arRating[$commentId]["TOTAL_NEGATIVE_VOTES"], "TOTAL_VALUE" => $arRating[$commentId]["TOTAL_VALUE"], "PATH_TO_USER_PROFILE" => $arUrl["USER"]);
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", $arFormatParams["RATING_TYPE"], $arRatingData, false, array("HIDE_ICONS" => "Y"));
$arCommentParams["BEFORE_ACTIONS"] = ob_get_clean();
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", "mobile_comment_" . $arFormatParams["RATING_TYPE"], $arRatingData, false, array("HIDE_ICONS" => "Y"));
$arCommentParams["BEFORE_ACTIONS_MOBILE"] = ob_get_clean();
}
$arUFResult = self::BuildUFFields($arComment["UF"]);
$arCommentParams["AFTER"] .= $arUFResult["AFTER"];
$arCommentParams["AFTER_MOBILE"] .= $arUFResult["AFTER_MOBILE"];
if ($arComment["CAN_EDIT"] == "Y") {
ob_start();
?>
<script>
top.text<?php
echo $commentId;
?>
= text<?php
echo $commentId;
?>
= '<?php
echo CUtil::JSEscape(htmlspecialcharsBack($arComment["POST_TEXT"]));
?>
';
top.title<?php
echo $commentId;
?>
= title<?php
echo $commentId;
?>
= '<?php
echo isset($arComment["TITLE"]) ? CUtil::JSEscape($arComment["TITLE"]) : '';
?>
';
top.arComFiles<?php
echo $commentId;
?>
= [];<?php
?>
</script><?php
$arCommentParams["AFTER"] .= ob_get_clean();
}
CPullWatch::AddToStack('UNICOMMENTSBLOG_' . $arPost["ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => $arCommentParams));
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:blog_comment.php
示例4: htmlspecialcharsbx
"BLOG_CATEGORY" => $arParams["PAGE_VAR"]."=blog&".$arParams["BLOG_VAR"]."=#blog#"."&category=#category_id#",
"BLOG_POSTS" => $arParams["PAGE_VAR"]."=blog_posts&".$arParams["USER_VAR"]."=#user_id#",
"POST" => $arParams["PAGE_VAR"]."=post&".$arParams["BLOG_VAR"]."=#blog#&".$arParams["POST_VAR"]."=#post_id#",
"POST_EDIT" => $arParams["PAGE_VAR"]."=post_edit&".$arParams["BLOG_VAR"]."=#blog#&".$arParams["POST_VAR"]."=#post_id#",
"USER" => $arParams["PAGE_VAR"]."=user&".$arParams["USER_VAR"]."=#user_id#",
"SMILE" => "") as $url => $val) {
$arParams["~PATH_TO_".$url] = (empty($arParams["PATH_TO_".$url]) ? $APPLICATION->GetCurPage()."?".$val : $arParams["PATH_TO_".$url]);
$arParams["PATH_TO_".$url] = htmlspecialcharsbx($arParams["~PATH_TO_".$url]);
}
/************** ADDITIONAL *****************************************/
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
$arParams["NAME_TEMPLATE"] = (empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat() : $arParams["NAME_TEMPLATE"]);
$arParams["SHOW_LOGIN"] = ($arParams["SHOW_LOGIN"] == "Y");
$arParams["AVATAR_SIZE"] = intval($arParams["AVATAR_SIZE"]);
$arParams["SET_TITLE"] = "N";
CRatingsComponentsMain::GetShowRating($arParams); // $arParams["SHOW_RATING"]
$arParams["MESSAGE_LENGTH"] = ($arParams["MESSAGE_LENGTH"] > 0 ? $arParams["MESSAGE_LENGTH"] : 90);
/************** CACHE **********************************************/
if (!isset($arParams["CACHE_TIME"]))
$arParams["CACHE_TIME"] = 3600;
if ($arParams["CACHE_TYPE"] == "Y" || ($arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y"))
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
else
$arParams["CACHE_TIME"] = 0;
$arParams["CACHE_TAGS"] = (!empty($arParams["CACHE_TAGS"]) ? $arParams["CACHE_TAGS"] : array());
//$arParams["CACHE_TIME"] = 0;
/********************************************************************
/Input params
********************************************************************/
global $CACHE_MANAGER;
$cache_path = "/".SITE_ID.CComponentEngine::MakeComponentPath("bitrix:socialnetwork.blog.blog");
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:component.php
注:本文中的CRatingsComponentsMain类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论