本文整理汇总了PHP中AddEventHandler函数的典型用法代码示例。如果您正苦于以下问题:PHP AddEventHandler函数的具体用法?PHP AddEventHandler怎么用?PHP AddEventHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddEventHandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct(&$component)
{
global $APPLICATION;
$this->component =& $component;
$arResult =& $component->arResult;
$arParams =& $component->arParams;
$_REQUEST["FILES"] = is_array($_REQUEST["FILES"]) ? $_REQUEST["FILES"] : array();
$_REQUEST["FILES_TO_UPLOAD"] = is_array($_REQUEST["FILES_TO_UPLOAD"]) ? $_REQUEST["FILES_TO_UPLOAD"] : array();
if (isset($arParams['FILES_COUNT']) && (intval($arParams['FILES_COUNT']) > 0 || $arParams['FILES_COUNT'] === 0)) {
$this->filesCount = intval($arParams['FILES_COUNT']);
}
if (isset($arParams['IMAGE_SIZE']) && (intval($arParams['IMAGE_SIZE']) > 0 || $arParams['IMAGE_SIZE'] === 0)) {
$this->imageSize = intval($arParams['IMAGE_SIZE']);
}
$APPLICATION->AddHeadScript("/bitrix/js/main/utils.js");
$APPLICATION->AddHeadScript("/bitrix/js/forum/popup_image.js");
AddEventHandler("forum", "OnPrepareComments", array(&$this, "OnPrepareComments"));
AddEventHandler("forum", "OnCommentDispay", array(&$this, "OnCommentDispay"));
if ($arResult["FORUM"]["ALLOW_UPLOAD"] !== "N") {
AddEventHandler("forum", "OnCommentAdd", array(&$this, "OnCommentAdd"));
AddEventHandler("forum", "OnCommentPreview", array(&$this, "OnCommentPreview"));
AddEventHandler("forum", "OnCommentFormDisplay", array(&$this, "OnCommentFormDisplay"));
AddEventHandler("forum", "OnCommentPreviewDisplay", array(&$this, "OnCommentPreviewDisplay"));
}
}
示例2: ForumEventManager
function ForumEventManager()
{
if (IsModuleInstalled("iblock")) {
AddEventHandler("forum", "onAfterMessageAdd", array(&$this, "updateIBlockPropertyAfterAddingMessage"));
AddEventHandler("forum", "onMessageModerate", array(&$this, "updateIBlockProperty"));
AddEventHandler("forum", "onAfterMessageDelete", array(&$this, "updateIBlockPropertyAfterDeletingMessage"));
}
}
示例3: __construct
function __construct(&$component)
{
$this->component =& $component;
if (isset($this->component->arResult['FORUM']['INDEXATION']) && $this->component->arResult['FORUM']['INDEXATION'] == 'Y') {
AddEventHandler("forum", "OnCommentDispay", array(&$this, "OnCommentDispay"));
AddEventHandler("forum", "OnPrepareComments", array($this, "OnPrepareComments"));
}
}
示例4: GetAuditTypes
function GetAuditTypes()
{
AddEventHandler("main", "GetAuditTypesForum", array("CForumEventLog", "GetAuditTypes"));
foreach (GetModuleEvents("main", "GetAuditTypesForum", true) as $arEvent) {
$AuditTypes = ExecuteModuleEventEx($arEvent);
}
return $AuditTypes;
}
示例5: __construct
function __construct(&$component)
{
global $APPLICATION;
$this->component =& $component;
$arResult =& $component->arResult;
$arParams =& $component->arParams;
AddEventHandler("forum", "OnCommentsInit", array(&$this, "OnCommentsInit"));
AddEventHandler("forum", "OnPrepareComments", array(&$this, "OnPrepareComments"));
}
示例6: GetAuditTypes
function GetAuditTypes()
{
AddEventHandler("main", "GetAuditTypesIblock", array("CAllIBlock", "GetAuditTypes"));
$db_events = GetModuleEvents("main", "GetAuditTypesIblock");
while ($arEvent = $db_events->Fetch()) {
$AuditTypes = ExecuteModuleEventEx($arEvent);
}
return $AuditTypes;
}
示例7: GetUserTypeDescription
function GetUserTypeDescription()
{
AddEventHandler("main", "OnBeforeUserTypeUpdate", array(__CLASS__, "CheckSettings"));
AddEventHandler("main", "OnBeforeUserTypeAdd", array(__CLASS__, "CheckSettings"));
if (IsModuleInstalled("blog")) {
AddEventHandler("blog", "OnBeforePostUserFieldUpdate", array(__CLASS__, "OnBeforePostUserFieldUpdate"));
}
return array("USER_TYPE_ID" => "vote", "CLASS_NAME" => __CLASS__, "DESCRIPTION" => GetMessage("V_USER_TYPE_DESCRIPTION"), "BASE_TYPE" => "int");
}
示例8: register
/**
* Регистрация пункта меню
*/
public function register()
{
foreach ($this->items as &$item) {
$this->setChildrenItemsId($item);
}
AddEventHandler("main", "OnBuildGlobalMenu", function () {
return [$this->menu_id => $this->toArray()];
});
}
示例9: setEnable
/**
* Creates or updates the manifest file for the page with usage its content.
*
* @param $content
*/
public static function setEnable($isEnable = true)
{
$selfObject = self::getInstance();
if ($isEnable && !$selfObject->isEnable) {
AddEventHandler("main", "OnBeforeEndBufferContent", array(__CLASS__, "onBeforeEndBufferContent"));
AddEventHandler("main", "OnEndBufferContent", array(__CLASS__, "onEndBufferContent"));
$selfObject->isEnable = true;
}
}
示例10: GetInstance
public static function GetInstance()
{
static $instance = null;
if ($instance === null)
$instance = new static();
AddEventHandler("main", "OnEpilog",
array("CNocaptcha", "AddSettingsAndScript"));
return $instance;
}
示例11: RegisterVirtualIOCompatibility
function RegisterVirtualIOCompatibility($baseDir = '')
{
static $IOCompartible = 'BX_IO_Compartible';
if (defined($IOCompartible)) {
return false;
}
define($IOCompartible, 'Y');
AddEventHandler('main', 'BXVirtualIO_ConvertCharset', array($this, 'VirtualIO_ConvertCharset'));
return true;
}
示例12: InitLogEvents
function InitLogEvents(&$webdav)
{
static $loaded = false;
if ($webdav->Type === "iblock" && !$loaded) {
$loaded = true;
$this->iblock_id = $webdav->IBLOCK_ID;
$event_names = array_keys($this->events);
foreach ($event_names as $k) {
AddEventHandler("webdav", $k, array(&$this, $k));
}
}
}
示例13: InstallUserFields
function InstallUserFields()
{
global $USER_FIELD_MANAGER, $APPLICATION;
AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeWebdavElement", "GetUserTypeDescription"));
AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeWebdavElementHistory", "GetUserTypeDescription"));
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webdav/classes/usertypewebdav.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webdav/classes/usertypewebdavelementhistory.php";
$USER_FIELD_MANAGER->CleanCache();
$USER_FIELD_MANAGER->arUserTypes = '';
$arFields = array("BLOG_POST" => array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_FILE", "XML_ID" => "UF_BLOG_POST_FILE"), "BLOG_COMMENT" => array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FILE", "XML_ID" => "UF_BLOG_COMMENT_FILE"));
$arFieldProps = array("USER_TYPE_ID" => "webdav_element", "SORT" => 100, "MULTIPLE" => "Y", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "");
$typeData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FH", "XML_ID" => "UF_BLOG_COMMENT_FH"));
if (!($typeData = $typeData->Fetch())) {
$arFieldPropsHistory = array("USER_TYPE_ID" => "webdav_element_history", "SORT" => 100, "MULTIPLE" => "N", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "", "ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FH", "XML_ID" => "UF_BLOG_COMMENT_FH");
$obUserField = new CUserTypeEntity();
$intID = $obUserField->Add($arFieldPropsHistory);
if (false == $intID) {
if ($strEx = $APPLICATION->GetException()) {
$this->errors[] = $strEx->GetString();
}
}
}
foreach ($arFields as $fieldName => $arField) {
$rsData = CUserTypeEntity::GetList(array(), $arField);
if ($arRes = $rsData->Fetch()) {
$intID = $arRes['ID'];
} else {
$arProps = $arFieldProps + $arField;
$obUserField = new CUserTypeEntity();
$intID = $obUserField->Add($arProps);
if (false == $intID) {
if ($strEx = $APPLICATION->GetException()) {
$this->errors[] = $strEx->GetString();
}
}
}
}
$rsData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "XML_ID" => "UF_BLOG_POST_F_EDIT"));
$arRes = $rsData->Fetch();
if (!$arRes) {
$arFieldProps = array("USER_TYPE_ID" => "boolean", "SORT" => 100, "MULTIPLE" => "N", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "", "ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_F_EDIT", "XML_ID" => "UF_BLOG_POST_F_EDIT");
$obUserField = new CUserTypeEntity();
$propID = $obUserField->Add($arFieldProps, false);
}
$rsData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "XML_ID" => "UF_BLOG_POST_FILE"));
$arRes = $rsData->Fetch();
if ($arRes && empty($arRes['SETTINGS']['UF_TO_SAVE_ALLOW_EDIT'])) {
$arRes['SETTINGS']['UF_TO_SAVE_ALLOW_EDIT'] = 'UF_BLOG_POST_F_EDIT';
$obUserField = new CUserTypeEntity();
$res = $obUserField->Update($arRes['ID'], array('SETTINGS' => $arRes['SETTINGS']));
}
}
示例14: __construct
function __construct()
{
AddEventHandler("vote", "onAfterVoteChannelAdd", array(&$this, "OnAfterVoteChannelChange"));
AddEventHandler("vote", "onAfterVoteChannelUpdate", array(&$this, "OnAfterVoteChannelChange"));
AddEventHandler("vote", "onAfterChannelDelete", array(&$this, "OnAfterVoteChannelChange"));
AddEventHandler("vote", "onAfterVoteAdd", array(&$this, "OnAfterVoteChange"));
AddEventHandler("vote", "onAfterVoteUpdate", array(&$this, "OnAfterVoteChange"));
AddEventHandler("vote", "onAfterVoteDelete", array(&$this, "OnAfterVoteChange"));
AddEventHandler("vote", "onVoteReset", array(&$this, "OnAfterVoteChange"));
AddEventHandler("vote", "onAfterVoting", array(&$this, "OnAfterVoteChange"));
if (defined("BX_COMP_MANAGED_CACHE")) {
AddEventHandler("vote", "onAfterVoteQuestionAdd", array(&$this, "OnAfterVoteQuestionAdd"));
AddEventHandler("vote", "onBeforeVoteQuestionUpdate", array(&$this, "OnBeforeVoteQuestionUpdate"));
AddEventHandler("vote", "onAfterVoteQuestionUpdate", array(&$this, "OnAfterVoteQuestionUpdate"));
AddEventHandler("vote", "onAfterVoteQuestionDelete", array(&$this, "OnAfterVoteQuestionDelete"));
AddEventHandler("vote", "onAfterVoteAnswerAdd", array(&$this, "OnAfterVoteAnswerAdd"));
AddEventHandler("vote", "onBeforeVoteAnswerUpdate", array(&$this, "OnBeforeVoteAnswerUpdate"));
AddEventHandler("vote", "onAfterVoteAnswerUpdate", array(&$this, "OnAfterVoteAnswerUpdate"));
AddEventHandler("vote", "onAfterVoteAnswerDelete", array(&$this, "OnAfterVoteAnswerDelete"));
}
}
示例15: setEnable
/**
* Sets isEnable property value
* @param bool $isEnable
*/
public static function setEnable($isEnable = true)
{
if ($isEnable && !self::$isEnable) {
self::$onBeforeHandleKey = AddEventHandler("main", "OnBeforeEndBufferContent", array(__CLASS__, "OnBeforeEndBufferContent"));
self::$onHandleKey = AddEventHandler("main", "OnEndBufferContent", array(__CLASS__, "OnEndBufferContent"));
self::$isEnable = true;
\CJSCore::init(array("fc"), false);
$actionType = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_ACTION_TYPE");
if ($actionType == "get_dynamic") {
//Is it the background request?
self::$isBackgroundRequest = true;
}
} elseif (!$isEnable && self::$isEnable) {
if (self::$onBeforeHandleKey >= 0) {
RemoveEventHandler("main", "OnBeforeEndBufferContent", self::$onBeforeHandleKey);
}
if (self::$onBeforeHandleKey >= 0) {
RemoveEventHandler("main", "OnEndBufferContent", self::$onHandleKey);
}
self::$isEnable = false;
}
}