本文整理汇总了PHP中Bitrix\Main\Loader::includeModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::includeModule方法的具体用法?PHP Loader::includeModule怎么用?PHP Loader::includeModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Loader
的用法示例。
在下文中一共展示了Loader::includeModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param array $config
*/
public function __construct(array $config = null)
{
Loader::includeModule('highloadblock');
if ($config) {
$this->config($config);
}
}
示例2: getPropDirectory
function getPropDirectory(&$property)
{
if (empty($property)) {
return false;
}
if (!is_array($property)) {
return false;
}
if (!isset($property['USER_TYPE_SETTINGS']['TABLE_NAME']) || empty($property['USER_TYPE_SETTINGS']['TABLE_NAME'])) {
return false;
}
$highLoadInclude = \Bitrix\Main\Loader::includeModule('highloadblock');
$highBlock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array("filter" => array('TABLE_NAME' => $property['USER_TYPE_SETTINGS']['TABLE_NAME'])))->fetch();
if (!isset($highBlock['ID'])) {
return false;
}
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($highBlock);
$entityDataClass = $entity->getDataClass();
$entityList = $entityDataClass::getList();
while ($arEntityItem = $entityList->Fetch()) {
$val =& $property["VALUES"][$arEntityItem["UF_XML_ID"]];
//foreach($property["VALUES"] as &$val){
if (!empty($arEntityItem["UF_FILE"])) {
$property["PICTURE_INCLUDED"] = true;
$arEntityItem["~UF_FILE"] = $arEntityItem["UF_FILE"];
$arEntityItem["PICTURE"] = CFile::GetPath($arEntityItem["~UF_FILE"]);
}
if (!empty($arEntityItem)) {
$val = array_merge($val, $arEntityItem);
}
//}
//echo'<pre>';print_r($arEntityItem);echo'</pre>';
}
return true;
}
示例3: getDirStructure
public static function getDirStructure($bLogical, $site, $path)
{
global $USER;
$arDirContent = array();
if ($USER->CanDoFileOperation('fm_view_listing', array($site, $path))) {
\Bitrix\Main\Loader::includeModule('fileman');
$arDirs = array();
$arFiles = array();
\CFileMan::GetDirList(array($site, $path), $arDirs, $arFiles, array(), array("NAME" => "asc"), "DF", $bLogical, true);
$arDirContent_t = array_merge($arDirs, $arFiles);
for ($i = 0, $l = count($arDirContent_t); $i < $l; $i++) {
$file = $arDirContent_t[$i];
$arPath = array($site, $file['ABS_PATH']);
if ($file["TYPE"] == "F" && !$USER->CanDoFileOperation('fm_view_file', $arPath) || $file["TYPE"] == "D" && !$USER->CanDoFileOperation('fm_view_listing', $arPath) || $file["TYPE"] == "F" && $file["NAME"] == ".section.php") {
continue;
}
$f = $file['TYPE'] == 'F' ? new \Bitrix\Main\IO\File($file['PATH'], $site) : new \Bitrix\Main\IO\Directory($file['PATH'], $site);
$p = $f->getName();
if ($f->isSystem() || $file['TYPE'] == 'F' && in_array($p, array("urlrewrite.php")) || $file['TYPE'] == 'D' && preg_match("/\\/(bitrix|" . \COption::getOptionString("main", "upload_dir", "upload") . ")\\//", "/" . $p . "/")) {
continue;
}
$arFileData = array('NAME' => $bLogical ? $file['LOGIC_NAME'] : $p, 'FILE' => $p, 'TYPE' => $file['TYPE'], 'DATA' => $file);
if (strlen($arFileData['NAME']) <= 0) {
$arFileData['NAME'] = GetMessage('SEO_DIR_LOGICAL_NO_NAME');
}
$arDirContent[] = $arFileData;
}
unset($arDirContent_t);
}
return $arDirContent;
}
示例4: onMessageAdd
/**
* Increments conversion post day counter
*
* @param int $id Topic ID.
* @param array $message Message fields.
* @param array $topicInfo Message TOPIC_INFO field.
* @param array $forumInfo Message FORUM_INFO field.
* @param array $fields Message fields used to insert.
* @return void
*/
public static function onMessageAdd($id, $message, $topicInfo, $forumInfo, $fields)
{
if (Loader::includeModule('conversion')) {
$context = DayContext::getInstance();
$context->addDayCounter('forum_post_add_day', 1);
}
}
示例5: OnBasketAddHandler
function OnBasketAddHandler($ID, $arFields)
{
global $USER;
\Bitrix\Main\Loader::includeModule('catalog');
\Bitrix\Main\Loader::includeModule('sale');
if ($USER->IsAuthorized()) {
$arFilter = array("USER_ID" => $USER->GetID());
$db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
$arrCount = [];
while ($ar_sales = $db_sales->Fetch()) {
$arrCount[] = $ar_sales;
}
if (is_array($arrCount) == false) {
$res = CCatalogDiscount::SetCoupon('SL-CDUEA-HI8MMPY');
//3%
} else {
if (count($arrCount) >= 1) {
$resClean = CCatalogDiscount::ClearCoupon('SL-CDUEA-HI8MMPY');
$res5 = CCatalogDiscount::SetCoupon('SL-0JG2C-XIHBEYZ');
//5%
} else {
}
}
} else {
$res = CCatalogDiscountCoupon::SetCoupon('SL-CDUEA-HI8MMPY');
//3%
}
}
示例6: isDesktopImOnline
/**
* Checks online status of IM.
* @return bool
*/
public static function isDesktopImOnline()
{
if (!Loader::includeModule('im')) {
return false;
}
return \CIMMessenger::checkDesktopStatusOnline();
}
示例7: getTabs
public static function getTabs($iblockElementInfo)
{
$showTab = false;
$request = Context::getCurrent()->getRequest();
if ($iblockElementInfo["ID"] > 0 && (!isset($request['action']) || $request['action'] != 'copy')) {
$showTab = true;
if (Loader::includeModule('catalog')) {
/*
$dbRes = CatalogIblockTable::getList(array(
'filter' => array(
'=IBLOCK_ID' => $iblockElementInfo["IBLOCK"]["ID"],
'!PRODUCT_IBLOCK_ID' => 0
),
'select' => array('IBLOCK_ID'),
));
if($dbRes->fetch())
{
$showTab = false;
}
*/
if (\CCatalogSku::getInfoByOfferIBlock($iblockElementInfo["IBLOCK"]["ID"]) !== false) {
$showTab = false;
}
}
}
return $showTab ? array(array("DIV" => "seo_adv", "SORT" => 4, "TAB" => Loc::getMessage("SEO_ADV_TAB"), "TITLE" => Loc::getMessage("SEO_ADV_TAB_TITLE"))) : null;
}
示例8: onPrepareComponentParams
public function onPrepareComponentParams($arParams)
{
$arParams['ERROR'] = array();
if (!Loader::includeModule('lists') || !Loader::includeModule('bizproc')) {
$arParams['ERROR'][] = Loc::getMessage('CC_BLL_MODULE_NOT_INSTALLED');
return $arParams;
}
global $USER;
$arParams['LIST_PERM'] = CListPermissions::CheckAccess($USER, COption::GetOptionString("lists", "livefeed_iblock_type_id"), false);
if ($arParams['LIST_PERM'] < 0) {
switch ($arParams['LIST_PERM']) {
case CListPermissions::WRONG_IBLOCK_TYPE:
$arParams['ERROR'][] = Loc::getMessage("CC_BLL_WRONG_IBLOCK_TYPE");
break;
case CListPermissions::WRONG_IBLOCK:
$arParams['ERROR'][] = Loc::getMessage("CC_BLL_WRONG_IBLOCK");
break;
case CListPermissions::LISTS_FOR_SONET_GROUP_DISABLED:
$arParams['ERROR'][] = Loc::getMessage("CC_BLL_LISTS_FOR_SONET_GROUP_DISABLED");
break;
default:
$arParams['ERROR'][] = Loc::getMessage("CC_BLL_UNKNOWN_ERROR");
break;
}
} elseif ($arParams['LIST_PERM'] <= CListPermissions::ACCESS_DENIED) {
$arParams['ERROR'][] = Loc::getMessage("CC_BLL_ACCESS_DENIED");
}
$arParams['IBLOCK_TYPE_ID'] = COption::GetOptionString("lists", "livefeed_iblock_type_id");
return $arParams;
}
示例9: DoInstall
function DoInstall() {
global $APPLICATION, $data;
$loc = \WS\Migrations\Module::getInstance()->getLocalization('setup');
$options = \WS\Migrations\Module::getInstance()->getOptions();
global $errors;
$errors = array();
if ($data['catalog']) {
$dir = $_SERVER['DOCUMENT_ROOT'].$data['catalog'];
if (!is_dir($dir)) {
mkdir($dir);
}
if (!is_dir($dir)) {
$errors[] = $loc->getDataByPath('error.notCreateDir');
}
if (!$errors) {
$options->catalogPath = $data['catalog'];
}
$this->InstallFiles();
$this->InstallDB();
RegisterModule(self::MODULE_ID);
\Bitrix\Main\Loader::includeModule(self::MODULE_ID);
\Bitrix\Main\Loader::includeModule('iblock');
\WS\Migrations\Module::getInstance()->install();
}
if (!$data || $errors) {
$APPLICATION->IncludeAdminFile($loc->getDataByPath('title'), __DIR__.'/form.php');
return;
}
}
示例10: onExecuteStartWriting
function onExecuteStartWriting(\Bitrix\Main\Event $event)
{
$parameters = $event->getParameters();
$userId = $parameters[0];
$dialogId = $parameters[1] . $parameters[2];
if ($userId > 0) {
if (!\Bitrix\Main\Loader::includeModule('pull')) {
return;
}
\CPushManager::DeleteFromQueueBySubTag($userId, 'IM_MESS');
if (intval($dialogId) > 0) {
\CPullStack::AddByUser($dialogId, array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
} elseif (substr($dialogId, 0, 4) == 'chat') {
$chatId = substr($dialogId, 4);
$arRelation = \CIMChat::GetRelationById($chatId);
unset($arRelation[$userId]);
$pullMessage = array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId));
\CPullStack::AddByUsers(array_keys($arRelation), $pullMessage);
$orm = \Bitrix\Im\ChatTable::getById($chatId);
$chat = $orm->fetch();
if ($chat['TYPE'] == IM_MESSAGE_OPEN) {
\CPullWatch::AddToStack('IM_PUBLIC_' . $chatId, $pullMessage);
}
}
}
}
示例11: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!Loader::includeModule('search')) {
throw new BitrixException('Search module is not installed');
}
$searchResult = array();
$bar = new ProgressBar($output, 0);
do {
$bar->display();
$searchResult = \CSearch::ReIndexAll($input->getOption('full'), static::UPDATE_TIME, $searchResult);
$bar->advance();
$bar->clear();
if (is_array($searchResult) && $searchResult['MODULE'] == 'main') {
list(, $path) = explode("|", $searchResult["ID"], 2);
$output->writeln("\r " . $path, OutputInterface::VERBOSITY_VERBOSE);
}
} while (is_array($searchResult));
$bar->finish();
$bar->clear();
$output->write("\r");
if (ModuleManager::isModuleInstalled('socialnetwork')) {
$output->writeln('<info>The Social Network module needs to be reindexed using the Social Network component in the public section of site.</info>');
}
$output->writeln(sprintf('<info>Reindexed</info> %d element%s.', $searchResult, $searchResult > 1 ? 's' : ''));
return 0;
}
示例12: __construct
public function __construct($component = null)
{
parent::__construct($component);
\Bitrix\Main\Loader::includeModule("forum");
$this->componentId = $this->isAjaxRequest() ? randString(7) : $this->randString();
$this->errorCollection = new ErrorCollection();
}
示例13: checkRequiredModules
protected function checkRequiredModules()
{
if (!Loader::includeModule('bizproc')) {
throw new SystemException('Install module "bizproc"');
}
return $this;
}
示例14: onBannerClick
/**
* Increments conversion banner click day counter
*
* @param int $id Banner ID.
* @param array $fields Banner fields.
* @return void
*/
public static function onBannerClick($id, $fields)
{
if (Loader::includeModule('conversion')) {
$context = DayContext::getInstance();
$context->addDayCounter('advertising_banner_click_day', 1);
}
}
示例15: executeComponent
public function executeComponent()
{
try {
if ($this->notCache() || $this->StartResultCache(false)) {
if (!Loader::includeModule('iblock')) {
ShowError(GetMessage("IT_MODULE_NOT_INSTALLED"));
return;
}
$this->inCacheFunction();
if ($this->includeComponentTemplateInCache) {
$this->SetResultCacheKeys($this->arSaveInCacheKeys);
$this->IncludeComponentTemplate();
} else {
$this->EndResultCache();
}
}
$this->lastCacheFunction();
if (!$this->includeComponentTemplateInCache) {
$this->IncludeComponentTemplate();
}
} catch (Exception $exc) {
if ($this->set404) {
@define("ERROR_404", "Y");
} elseif ($this->showError) {
$this->__showError($exc->getMessage());
}
$this->AbortResultCache();
}
}