当前位置: 首页>>代码示例>>PHP>>正文


PHP Main\Loader类代码示例

本文整理汇总了PHP中Bitrix\Main\Loader的典型用法代码示例。如果您正苦于以下问题:PHP Loader类的具体用法?PHP Loader怎么用?PHP Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connectInternal

 /**
  * Establishes a connection to the database.
  * Includes php_interface/after_connect_d7.php on success.
  * Throws exception on failure.
  *
  * @return void
  * @throws \Bitrix\Main\DB\ConnectionException
  */
 protected function connectInternal()
 {
     if ($this->isConnected) {
         return;
     }
     $connectionInfo = array("UID" => $this->login, "PWD" => $this->password, "Database" => $this->database, "ReturnDatesAsStrings" => true);
     if (($this->options & self::PERSISTENT) != 0) {
         $connectionInfo["ConnectionPooling"] = true;
     } else {
         $connectionInfo["ConnectionPooling"] = false;
     }
     $connection = sqlsrv_connect($this->host, $connectionInfo);
     if (!$connection) {
         throw new ConnectionException('MS Sql connect error', $this->getErrorMessage());
     }
     $this->resource = $connection;
     $this->isConnected = true;
     // hide cautions
     sqlsrv_configure("WarningsReturnAsErrors", 0);
     /** @noinspection PhpUnusedLocalVariableInspection */
     global $DB, $USER, $APPLICATION;
     if ($fn = \Bitrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
         include $fn;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:33,代码来源:mssqlconnection.php

示例2: checkParams

 protected static function checkParams($arMessage = array(), &$arTopic, &$arForum)
 {
     if (\Bitrix\Main\Loader::includeModule('forum')) {
         $arTopic = !empty($arTopic) ? $arTopic : \CForumTopic::GetByID($arMessage["TOPIC_ID"]);
         if (empty($arTopic)) {
             return false;
         }
         $arSitemaps = SitemapForumTable::getSitemapsByEntityId($arTopic["FORUM_ID"]);
         if (!empty($arSitemaps) && ($arForum = \CForumNew::GetByIDEx($arTopic["FORUM_ID"])) && $arForum) {
             $arForum["PATH2FORUM_MESSAGE"] = \CForumNew::GetSites($arTopic["FORUM_ID"]);
             $date = MakeTimeStamp($arTopic['LAST_POST_DATE']);
             $result = array();
             foreach ($arSitemaps as $arSitemap) {
                 $path = $arForum["PATH2FORUM_MESSAGE"][$arSitemap["SITE_ID"]];
                 if (!empty($path)) {
                     $arSitemap["fileName"] = str_replace("#FORUM_ID#", $arForum["ID"], $arSitemap['SITEMAP_FILE_FORUM']);
                     $arSitemap["url"] = \CForumNew::PreparePath2Message($path, array("FORUM_ID" => $arForum["ID"], "TOPIC_ID" => $arTopic["ID"], "TITLE_SEO" => $arTopic["TITLE_SEO"], "MESSAGE_ID" => "s", "SOCNET_GROUP_ID" => $arTopic["SOCNET_GROUP_ID"], "OWNER_ID" => $arTopic["OWNER_ID"], "PARAM1" => $arTopic["PARAM1"], "PARAM2" => $arTopic["PARAM2"]));
                     $arSitemap["date"] = $date;
                     $result[] = $arSitemap;
                 }
             }
             return empty($result) ? false : $result;
         }
     }
     return false;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:26,代码来源:sitemapforum.php

示例3: uninstallDB

 public function uninstallDB()
 {
     if (Loader::includeModule($this->MODULE_ID)) {
         $connection = Application::getInstance()->getConnection();
         $connection->dropTable(ExampleTable::getTableName());
     }
 }
开发者ID:rbaklanov,项目名称:bex.d7dull,代码行数:7,代码来源:index.php

示例4: 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;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:class.php

示例5: checkRequiredModules

	/**
	 * Function checks if required modules installed. If not, throws an exception
	 * @return void
	 */
	protected static function checkRequiredModules()
	{
		if (!Loader::includeModule('sale'))
			$this->errors['FATAL'][] = Loc::getMessage("SALE_SLS_SALE_MODULE_NOT_INSTALL");

		return true;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:11,代码来源:class.php

示例6: filter

 public function filter()
 {
     \Bitrix\Main\Loader::includeModule('sale');
     $daysBasketForgotten = $this->getFieldValue('DAYS_BASKET_FORGOTTEN');
     if (!is_numeric($daysBasketForgotten)) {
         $daysBasketForgotten = 90;
     }
     $dateFrom = new \Bitrix\Main\Type\DateTime();
     $dateTo = new \Bitrix\Main\Type\DateTime();
     $dateFrom->setTime(0, 0, 0)->add('-' . $daysBasketForgotten . ' days');
     $dateTo->setTime(0, 0, 0)->add('1 days')->add('-' . $daysBasketForgotten . ' days');
     if ($this->isRunForOldData()) {
         $filter = array('<MIN_DATE_INSERT' => $dateTo->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT));
     } else {
         $filter = array('>MIN_DATE_INSERT' => $dateFrom->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT), '<MIN_DATE_INSERT' => $dateTo->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT));
     }
     $filter = $filter + array('!FUSER.USER_ID' => null, '=ORDER_ID' => null, '=LID' => $this->getSiteId());
     $userListDb = \Bitrix\Sale\BasketTable::getList(array('select' => array('USER_ID' => 'FUSER.USER_ID', 'EMAIL' => 'FUSER.USER.EMAIL', 'FUSER_USER_NAME' => 'FUSER.USER.NAME'), 'filter' => $filter, 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('MIN_DATE_INSERT', 'MIN(%s)', 'DATE_INSERT')), 'order' => array('USER_ID' => 'ASC')));
     if ($userListDb->getSelectedRowsCount() > 0) {
         $userListDb->addFetchDataModifier(array($this, 'getFetchDataModifier'));
         $this->recipient = $userListDb;
         return true;
     } else {
         return false;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:triggerbasketforgotten.php

示例7: 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);
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:startwritinghandler.php

示例8: 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;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:seo_utils.php

示例9: __construct

 /**
  * @param array $config
  */
 public function __construct(array $config = null)
 {
     Loader::includeModule('highloadblock');
     if ($config) {
         $this->config($config);
     }
 }
开发者ID:marvin255,项目名称:bxmigrate,代码行数:10,代码来源:HighLoadIb.php

示例10: 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);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:conversionhandlers.php

示例11: 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;
}
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:35,代码来源:functions.php

示例12: 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%
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:28,代码来源:CCatalogDiscount.php

示例13: isDesktopImOnline

 /**
  * Checks online status of IM.
  * @return bool
  */
 public static function isDesktopImOnline()
 {
     if (!Loader::includeModule('im')) {
         return false;
     }
     return \CIMMessenger::checkDesktopStatusOnline();
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:desktop.php

示例14: initClassesList

 public static function initClassesList()
 {
     if (static::$classes !== null) {
         return true;
     }
     $classes = array('\\Bitrix\\Sale\\Delivery\\ExtraServices\\Enum' => 'lib/delivery/extra_services/enum.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store' => 'lib/delivery/extra_services/store.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\String' => 'lib/delivery/extra_services/string.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Checkbox' => 'lib/delivery/extra_services/checkbox.php');
     \Bitrix\Main\Loader::registerAutoLoadClasses('sale', $classes);
     unset($classes['\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store']);
     static::$classes = array_keys($classes);
     $event = new Event('sale', 'onSaleDeliveryExtraServicesClassNamesBuildList');
     $event->send();
     $resultList = $event->getResults();
     if (is_array($resultList) && !empty($resultList)) {
         $customClasses = array();
         foreach ($resultList as $eventResult) {
             /** @var  EventResult $eventResult*/
             if ($eventResult->getType() != EventResult::SUCCESS) {
                 throw new SystemException("Can't add custom tracking class successfully");
             }
             $params = $eventResult->getParameters();
             if (!empty($params) && is_array($params)) {
                 $customClasses = array_merge($customClasses, $params);
             }
         }
         if (!empty($customClasses)) {
             \Bitrix\Main\Loader::registerAutoLoadClasses(null, $customClasses);
             $classes = array_merge($customClasses, $classes);
         }
     }
     static::$classes = array_merge(array_keys($classes), static::$classes);
     return static::$classes;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:32,代码来源:manager.php

示例15: getMap

 /**
  * Returns entity map definition.
  *
  * @return array
  */
 public static function getMap()
 {
     \Bitrix\Main\Loader::includeModule('iblock');
     $metadata = ElementTable::getMetadata(static::$_iblockId);
     $map = array('IBLOCK_ELEMENT_ID' => array('data_type' => 'integer', 'primary' => true));
     foreach ($metadata['props'] as $arProp) {
         //            if ($arProp['MULTIPLE'] == 'Y') {
         //                continue;
         //            }
         switch ($arProp['PROPERTY_TYPE']) {
             case 'N':
                 $map[] = new Entity\FloatField($arProp['CODE'], array('column_name' => 'PROPERTY_' . $arProp['ID']));
                 break;
             case 'L':
             case 'E':
             case 'G':
                 $map[] = new IntegerField($arProp['CODE'], array('column_name' => 'PROPERTY_' . $arProp['ID']));
                 break;
             case 'S':
             default:
                 $map[] = new Entity\StringField($arProp['CODE'], array('column_name' => 'PROPERTY_' . $arProp['ID']));
                 break;
         }
     }
     return $map;
 }
开发者ID:chupo22,项目名称:bxtools,代码行数:31,代码来源:SinglePropertyElementTable.php


注:本文中的Bitrix\Main\Loader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。