$cache = new CPHPCache(); $cache_id = "blog_last_messages_" . serialize($arParams) . "_" . serialize($UserGroupID) . "_" . $USER->IsAdmin(); if (($tzOffset = CTimeZone::GetOffset()) != 0) { $cache_id .= "_" . $tzOffset; } if ($arParams["USE_SOCNET"] == "Y") { $cache_id .= "_" . $user_id; } $cache_path = "/" . SITE_ID . "/blog/last_messages/"; $arResult = array(); if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) { $Vars = $cache->GetVars(); foreach ($Vars["arResult"] as $k => $v) { $arResult[$k] = $v; } CBitrixComponentTemplate::ApplyCachedData($Vars["templateCachedData"]); $cache->Output(); } else { if ($arParams["CACHE_TIME"] > 0) { $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path); } $arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(time() + $tzOffset, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, ">PERMS" => BLOG_PERMS_DENY, "BLOG_ACTIVE" => "Y", "BLOG_GROUP_SITE_ID" => SITE_ID); if (strlen($arParams["BLOG_URL"]) > 0) { $arFilter["BLOG_URL"] = $arParams["BLOG_URL"]; } if (!empty($arParams["GROUP_ID"])) { $arFilter["BLOG_GROUP_ID"] = $arParams["GROUP_ID"]; } if ($USER->IsAdmin()) { unset($arFilter[">PERMS"]); }
/** * Function applies collection of the css files to the current template. * * <p>Note: component must be inited by initComponent method.</p> * @param array[string][int]string $templateCachedData * @return void * */ final public function setTemplateCachedData($templateCachedData) { if ($this->__bInited) CBitrixComponentTemplate::ApplyCachedData($templateCachedData); }
/** * Function applies collection of the css files to the current template. * * <p>Note: component must be inited by initComponent method.</p> * @param array[string][int]string $templateCachedData * @return void * */ public final function setTemplateCachedData($templateCachedData) { if ($this->__bInited && $this->__template) { $this->__template->ApplyCachedData($templateCachedData); } }