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


PHP Application::getInstance方法代码示例

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


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

示例1: 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

示例2: mobileDiskPrepareForJson

function mobileDiskPrepareForJson($string)
{
    if (!Application::getInstance()->isUtfMode()) {
        return Encoding::convertEncodingArray($string, SITE_CHARSET, 'UTF-8');
    }
    return $string;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:7,代码来源:disk_folder_list.php

示例3: __CrmActivityViewPrepareNameForJson

 function __CrmActivityViewPrepareNameForJson($string)
 {
     if (!\Bitrix\Main\Application::getInstance()->isUtfMode()) {
         return \Bitrix\Main\Text\Encoding::convertEncodingArray($string, SITE_CHARSET, 'UTF-8');
     }
     return $string;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:7,代码来源:template.php

示例4: acrit_exportpro

 function acrit_exportpro()
 {
     require __DIR__ . '/version.php';
     $path = str_replace("\\", "/", __FILE__);
     $path = substr($path, 0, strlen($path) - strlen("/index.php"));
     include $path . "/version.php";
     if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)) {
         $this->MODULE_VERSION = $arModuleVersion["VERSION"];
         $this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
     }
     $this->MODULE_NAME = GetMessage('ACRIT_EXPORTPRO_MODULE_NAME');
     $this->MODULE_DESCRIPTION = GetMessage('ACRIT_EXPORTPRO_MODULE_DESC');
     $this->PARTNER_NAME = GetMessage("ACRIT_EXPORTPRO_PARTNER_NAME");
     $this->PARTNER_URI = GetMessage("ACRIT_EXPORTPRO_PARTNER_URI");
     $app = \Bitrix\Main\Application::getInstance();
     $dbSite = \Bitrix\Main\SiteTable::getList();
     while ($arSite = $dbSite->Fetch()) {
         if (!$arSite['DOC_ROOT']) {
             $this->siteArray[$arSite['LID']] = $app->getDocumentRoot() . $arSite['DIR'];
         } else {
             $this->siteArray[$arSite['LID']] = $arSite['DOC_ROOT'];
         }
         $this->siteArray[$arSite['LID']] = \Bitrix\Main\IO\Path::normalize($this->siteArray[$arSite['LID']]);
     }
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:25,代码来源:index.php

示例5: addComment

 public function addComment($authorId, array $data)
 {
     $this->loadBlogPostData();
     $commentFields = array("POST_ID" => $this->entityId, "BLOG_ID" => $this->blogPostData['BLOG_ID'], "POST_TEXT" => $data['text'], "DATE_CREATE" => new DateTime(), "PARENT_ID" => false, "AUTHOR_ID" => $authorId, "HAS_PROPS" => 'Y');
     if (!empty($data['fileId'])) {
         $commentFields['UF_BLOG_COMMENT_FILE'] = array($data['fileId']);
     } elseif (!empty($data['versionId'])) {
         $commentFields['UF_BLOG_COMMENT_FH'] = $data['versionId'];
     }
     $comId = \CBlogComment::add($commentFields);
     if (!$comId) {
         return;
     }
     if (method_exists("CBlogComment", "addLiveComment")) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         \CBlogComment::addLiveComment($comId, array("MODE" => "PULL_MESSAGE"));
     }
     BXClearCache(true, "/blog/comment/" . $this->entityId . "/");
     if (!Loader::includeModule('socialnetwork')) {
         return;
     }
     $query = \CSocNetLog::getList(array("ID" => "DESC"), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $this->entityId), false, false, array("ID", "TMP_ID"));
     $row = $query->fetch();
     if (!$row) {
         return;
     }
     $fieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $this->blogPostData["AUTHOR_ID"], "EVENT_ID" => "blog_comment", "=LOG_DATE" => Application::getInstance()->getConnection()->getSqlHelper()->getCurrentDateTimeFunction(), "MESSAGE" => "file", "TEXT_MESSAGE" => "file", "URL" => "", "MODULE_ID" => false, "SOURCE_ID" => $comId, "LOG_ID" => $row["ID"], "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $comId, "USER_ID" => $authorId);
     \CSocNetLogComments::add($fieldsForSocnet, false, false, false);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:blogpostconnector.php

示例6: onPageStart

 /**
  * Passes an A/B-test mode string from request to session
  *
  * @return void
  */
 public static function onPageStart()
 {
     $applicationContext = Application::getInstance()->getContext();
     if ($mode = $applicationContext->getRequest()->get('abtest_mode')) {
         $_SESSION['ABTEST_MODE'] = $mode;
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:12,代码来源:eventhandler.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dir = $input->getOption('dir');
     $tag = $input->getOption('tag');
     $cache = Cache::createInstance();
     if (empty($dir) && empty($tag)) {
         Application::getInstance()->getManagedCache()->cleanAll();
         $cache->cleanDir();
         $cache->cleanDir(false, 'stack_cache');
         StaticHtmlCache::getInstance()->deleteAll();
         if (Cache::clearCache(true)) {
             $output->writeln('<info>All Bitrix cache was deleted</info>');
         } else {
             $output->writeln('<error>Error deleting Bitrix cache</error>');
         }
     }
     if ($dir) {
         $cache->cleanDir($dir);
         $output->writeln('<info>Bitrix cache by "/' . BX_ROOT . '/cache/' . $dir . '" dir was deleted</info>');
     }
     if ($tag) {
         Application::getInstance()->getTaggedCache()->clearByTag($tag);
         $output->writeln('<info>Bitrix cache by tag "' . $tag . '" was deleted</info>');
     }
 }
开发者ID:notamedia,项目名称:console-jedi,代码行数:28,代码来源:ClearCommand.php

示例8: send

 /**
  * @param array $data
  * @return Main\Entity\AddResult
  */
 public static function send(array $data)
 {
     $manageCache = Application::getInstance()->getManagedCache();
     if (CACHED_b_event !== false && $manageCache->read(CACHED_b_event, "events")) {
         $manageCache->clean('events');
     }
     $arFiles = array();
     if (isset($data['FILE'])) {
         if (is_array($data['FILE'])) {
             $arFiles = $data['FILE'];
         }
         unset($data['FILE']);
     }
     $result = MailInternal\EventTable::add($data);
     if ($result->isSuccess()) {
         $id = $result->getId();
         foreach ($arFiles as $file) {
             $arFile = \CFile::MakeFileArray($file);
             $arFile["MODULE_ID"] = "main";
             $fid = \CFile::SaveFile($arFile, "main");
             $dataAttachment = array('EVENT_ID' => $id, 'FILE_ID' => $fid);
             MailInternal\EventAttachmentTable::add($dataAttachment);
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:30,代码来源:event.php

示例9: InstallDB

 function InstallDB($install_wizard = true)
 {
     global $DB, $DBType, $APPLICATION;
     $errors = null;
     if (!$DB->Query("SELECT 'x' FROM b_disk_storage", true)) {
         $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/db/" . $DBType . "/install.sql");
     }
     $this->InstallTasks();
     if (!empty($errors)) {
         $APPLICATION->ThrowException(implode("", $errors));
         return false;
     }
     $isWebdavInstalled = isModuleInstalled('webdav');
     $this->RegisterModuleDependences(!$isWebdavInstalled);
     RegisterModule("disk");
     $this->InstallUserFields();
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     CAgent::addAgent('\\Bitrix\\Disk\\ExternalLink::removeExpiredWithTypeAuto();', 'disk', 'N');
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     CAgent::addAgent('\\Bitrix\\Disk\\Bitrix24Disk\\UploadFileManager::removeIrrelevant();', 'disk', 'N');
     if (!$isWebdavInstalled) {
         require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/lib/configuration.php";
         \Bitrix\Main\Config\Option::set('disk', 'successfully_converted', 'Y');
         \Bitrix\Main\Config\Option::set('disk', 'disk_revision_api', \Bitrix\Disk\Configuration::REVISION_API);
     } else {
         \CAdminNotify::add(array("MESSAGE" => Loc::getMessage("DISK_NOTIFY_MIGRATE_WEBDAV", array("#LINK#" => "/bitrix/admin/disk_from_webdav_convertor.php?lang=" . \Bitrix\Main\Application::getInstance()->getContext()->getLanguage())), "TAG" => "disk_migrate_from_webdav", "MODULE_ID" => "disk", "ENABLE_CLOSE" => "N"));
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:29,代码来源:index.php

示例10: __construct

 private function __construct()
 {
     $this->sqlBehavior = self::SQL_SKIP;
     $this->memoryBehavior = self::MEMORY_SKIP;
     $this->levelReporting = E_ALL | E_STRICT;
     $this->connection = Application::getInstance()->getConnection();
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:7,代码来源:diag.php

示例11: addProductsFromOrder

 /**
  * Add products from order or updates existing.
  *
  * @param $orderId
  *
  * @return void
  */
 public static function addProductsFromOrder($orderId = 0)
 {
     $orderId = (int) $orderId;
     if (Sale\OrderProcessingTable::hasAddedProducts($orderId)) {
         return;
     }
     $connection = Main\Application::getConnection();
     $type = $connection->getType();
     // Update existing
     if ($type == "mysql") {
         $sqlUpdate = "UPDATE b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tSET  p2p.CNT = p2p.CNT + 1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID";
     } elseif ($type == "mssql") {
         $sqlUpdate = "UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tFROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID";
     } else {
         $sqlUpdate = "UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tWHERE ID IN (\n\t\t\t\t\tSELECT p2p.ID FROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID\n\t\t\t\t\t)";
     }
     $connection->query($sqlUpdate);
     // Insert new
     $sqlInsert = "INSERT INTO b_sale_product2product (PRODUCT_ID, PARENT_PRODUCT_ID, CNT)\n\t\t\tSELECT b.PRODUCT_ID, b1.PRODUCT_ID, 1\n\t\t\tFROM b_sale_basket b, b_sale_basket b1\n\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\tNOT EXISTS (SELECT 1 FROM b_sale_product2product d WHERE d.PRODUCT_ID = b.PRODUCT_ID AND d.PARENT_PRODUCT_ID = b1.PRODUCT_ID)";
     $connection->query($sqlInsert);
     Sale\OrderProcessingTable::markProductsAdded($orderId);
     if (defined("BX_COMP_MANAGED_CACHE")) {
         $app = Main\Application::getInstance();
         $app->getTaggedCache()->clearByTag('sale_product_buy');
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:product2product.php

示例12: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         $storage = new EnvironmentStorage(Application::getInstance()->getContext()->getRequest());
         self::$instance = new static($storage);
     }
     return self::$instance;
 }
开发者ID:techart,项目名称:bitrix.tao,代码行数:8,代码来源:environment.php

示例13: check

 public function check($dummy, array $restrictionParams, $deliveryId = 0)
 {
     $context = Application::getInstance()->getContext();
     $request = $context->getRequest();
     if (empty($restrictionParams) || $request->isAdminSection()) {
         return true;
     }
     return $restrictionParams["PUBLIC_SHOW"] == 'Y';
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:bypublicmode.php

示例14: update

 public static function update($primary, array $data)
 {
     $result = parent::update($primary, $data);
     if (CACHED_b_lang !== false && $result->isSuccess()) {
         $cache = \Bitrix\Main\Application::getInstance()->getManagedCache();
         $cache->cleanDir("b_lang");
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:9,代码来源:culture.php

示例15: uninstallDB

 public function uninstallDB()
 {
     if (Loader::includeModule($this->MODULE_ID)) {
         $connection = Application::getInstance()->getConnection();
         $connection->dropTable(LotinfoConfigTable::getTableName());
         $connection->dropTable(LotinfoFieldsToPropsTable::getTableName());
         $connection->dropTable(LotinfoTypeToIBlockTable::getTableName());
     }
 }
开发者ID:HannibalLecktor,项目名称:alfa74,代码行数:9,代码来源:index.php


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