• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP IO\File类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: showTab

    public static function showTab($div, $iblockElementInfo)
    {
        $engineList = array();
        if (Option::get('main', 'vendor', '') == '1c_bitrix') {
            $engineList[] = array("DIV" => "yandex_direct", "TAB" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT"), "TITLE" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT_TITLE"), "HANDLER" => IO\Path::combine(Application::getDocumentRoot(), BX_ROOT, "/modules/seo/admin/tab/seo_search_yandex_direct.php"));
        }
        if (count($engineList) > 0) {
            $engineTabControl = new \CAdminViewTabControl("engineTabControl", $engineList);
            ?>
<tr>
	<td colspan="2">
<?php 
            $engineTabControl->begin();
            foreach ($engineList as $engineTab) {
                $engineTabControl->beginNextTab();
                $file = new IO\File($engineTab["HANDLER"]);
                if ($file->isExists()) {
                    require $file->getPath();
                }
            }
            $engineTabControl->end();
            ?>
	</td>
</tr>
<?php 
        }
    }
开发者ID:webgksupport,项目名称:alpina,代码行数:27,代码来源:advtabengine.php


示例2: seoSitemapGetFilesData

function seoSitemapGetFilesData($PID, $arSitemap, $arCurrentDir, $sitemapFile)
{
    global $NS;
    $arDirList = array();
    if ($arCurrentDir['ACTIVE'] == SitemapRuntimeTable::ACTIVE) {
        $list = \CSeoUtils::getDirStructure($arSitemap['SETTINGS']['logical'] == 'Y', $arSitemap['SITE_ID'], $arCurrentDir['ITEM_PATH']);
        foreach ($list as $dir) {
            $dirKey = "/" . ltrim($dir['DATA']['ABS_PATH'], "/");
            if ($dir['TYPE'] == 'F') {
                if (!isset($arSitemap['SETTINGS']['FILE'][$dirKey]) || $arSitemap['SETTINGS']['FILE'][$dirKey] == 'Y') {
                    if (preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $dir['FILE'])) {
                        $f = new IO\File($dir['DATA']['PATH'], $arSitemap['SITE_ID']);
                        $sitemapFile->addFileEntry($f);
                        $NS['files_count']++;
                    }
                }
            } else {
                if (!isset($arSitemap['SETTINGS']['DIR'][$dirKey]) || $arSitemap['SETTINGS']['DIR'][$dirKey] == 'Y') {
                    $arDirList[] = $dirKey;
                }
            }
        }
    } else {
        $len = strlen($arCurrentDir['ITEM_PATH']);
        if (!empty($arSitemap['SETTINGS']['DIR'])) {
            foreach ($arSitemap['SETTINGS']['DIR'] as $dirKey => $checked) {
                if ($checked == 'Y') {
                    if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) {
                        $arDirList[] = $dirKey;
                    }
                }
            }
        }
        if (!empty($arSitemap['SETTINGS']['FILE'])) {
            foreach ($arSitemap['SETTINGS']['FILE'] as $dirKey => $checked) {
                if ($checked == 'Y') {
                    if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) {
                        $fileName = IO\Path::combine(SiteTable::getDocumentRoot($arSitemap['SITE_ID']), $dirKey);
                        if (!is_dir($fileName)) {
                            $f = new IO\File($fileName, $arSitemap['SITE_ID']);
                            if ($f->isExists() && !$f->isSystem() && preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $f->getName())) {
                                $sitemapFile->addFileEntry($f);
                                $NS['files_count']++;
                            }
                        }
                    }
                }
            }
        }
    }
    if (count($arDirList) > 0) {
        foreach ($arDirList as $dirKey) {
            $arRuntimeData = array('PID' => $PID, 'ITEM_PATH' => $dirKey, 'PROCESSED' => SitemapRuntimeTable::UNPROCESSED, 'ACTIVE' => SitemapRuntimeTable::ACTIVE, 'ITEM_TYPE' => SitemapRuntimeTable::ITEM_TYPE_DIR);
            SitemapRuntimeTable::add($arRuntimeData);
        }
    }
    SitemapRuntimeTable::update($arCurrentDir['ID'], array('PROCESSED' => SitemapRuntimeTable::PROCESSED));
}
开发者ID:Satariall,项目名称:izurit,代码行数:58,代码来源:seo_sitemap_run.php


示例3: getRewriteRules

 /**
  * Returns urlrewrite array
  *
  * @param string $site Site ID.
  * @return array
  */
 private static function getRewriteRules($site)
 {
     $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
     $rewriteRules = array();
     $arUrlRewrite =& $rewriteRules;
     $rewriteFile = new IO\File($docRoot . '/urlrewrite.php');
     if ($rewriteFile->isExists()) {
         include $rewriteFile->getPath();
     }
     return $rewriteRules;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:17,代码来源:adminhelper.php


示例4: __construct

 /**
  * FileAccessManager constructor.
  *
  * @param string $path Full path to file .access.php
  *
  * @throws InvalidPathException Invalid path to file.
  */
 public function __construct($path)
 {
     if (empty($path)) {
         throw new InvalidPathException($path);
     }
     $this->path = $path;
     $file = new File($path);
     if ($file->getName() === '.access.php') {
         $this->isFileAccess = true;
     }
 }
开发者ID:bitrix-expert,项目名称:niceaccess,代码行数:18,代码来源:AccessFileHandler.php


示例5: finish

 public function finish()
 {
     foreach ($this->partList as $key => $partName) {
         $f = new File(Path::combine($this->getDirectoryName(), $partName));
         $f->rename(str_replace($this->getPrefix(), '', $f->getPath()));
         $this->partList[$key] = $f->getName();
     }
     if ($this->isCurrentPartNotEmpty()) {
         $this->addFooter();
         $this->rename(str_replace($this->getPrefix(), '', $this->getPath()));
     }
 }
开发者ID:supertest223,项目名称:bitrixtest,代码行数:12,代码来源:sitemapruntime.php


示例6: prepareDataToInsertFromFileArray

 protected static function prepareDataToInsertFromFileArray(array $fileData, array $data, ErrorCollection $errorCollection)
 {
     list($relativePath, $absolutePath) = self::generatePath();
     $file = new IO\File($fileData['tmp_name']);
     if (!$file->isExists()) {
         $errorCollection->addOne(new Error('Could not find file', self::ERROR_EXISTS_FILE));
         return null;
     }
     if (!$file->rename($absolutePath)) {
         $errorCollection->addOne(new Error('Could not move file', self::ERROR_MOVE_FILE));
         return null;
     }
     //now you can set CREATED_BY
     $data = array_intersect_key($data, array('CREATED_BY' => true));
     return array_merge(array('TOKEN' => bx_basename($relativePath), 'FILENAME' => $fileData['name'], 'PATH' => $relativePath, 'BUCKET_ID' => '', 'SIZE' => '', 'IS_CLOUD' => '', 'WIDTH' => empty($fileData['width']) ? '' : $fileData['width'], 'HEIGHT' => empty($fileData['height']) ? '' : $fileData['height']), $data);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:16,代码来源:tmpfile.php


示例7: isRequestedUriExists

 private function isRequestedUriExists()
 {
     /** @var $request HttpRequest */
     $request = $this->getContext()->getRequest();
     $absUrl = IO\Path::convertRelativeToAbsolute($request->getRequestedPage());
     return IO\File::isFileExists($absUrl);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:7,代码来源:httpapplication.php


示例8: writeStatistic

 /**
  * Updates cache usage statistics.
  * Each of parameters is added to appropriate existing stats.
  *
  * @param int $hit
  * @param int $miss
  * @param int $quota
  * @param int $posts
  * @param float $files
  * @return void
  */
 public function writeStatistic($hit = 0, $miss = 0, $quota = 0, $posts = 0, $files = 0.0)
 {
     $fileValues = $this->readStatistic();
     if ($fileValues) {
         $newValues = array(intval($fileValues["HITS"]) + $hit, intval($fileValues["MISSES"]) + $miss, intval($fileValues["QUOTA"]) + $quota, intval($fileValues["POSTS"]) + $posts, $files === false ? 0 : doubleval($fileValues["FILE_SIZE"]) + doubleval($files));
         $this->statFile->putContents(implode(",", $newValues));
     }
 }
开发者ID:spas-viktor,项目名称:books,代码行数:19,代码来源:statichtmlcache.php


示例9: createMap

 private function createMap()
 {
     $mapFilePath = Application::getDocumentRoot() . "/bitrix/modules/mobileapp/maps/config.php";
     $file = new File($mapFilePath);
     if (!$file->isExists()) {
         throw new SystemException("The map file  '" . $mapFilePath . "' doesn't exists!", 100);
     }
     $map = (include $mapFilePath);
     if (!is_array($map)) {
         throw new SystemException("The map file does exist but has some broken structure.", 101);
     }
     self::$configMap = $map;
     self::$configMap["groups"] = array();
     $groupTypes = array(ParameterType::GROUP, ParameterType::GROUP_BACKGROUND, ParameterType::GROUP_BACKGROUND_LIGHT);
     foreach ($map["types"] as $paramName => $intType) {
         if (in_array($intType, $groupTypes)) {
             self::$configMap["groups"][] = $paramName;
         }
     }
 }
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:20,代码来源:configmap.php


示例10: __construct

 public function __construct($type)
 {
     parent::__construct();
     $type = trim(strtolower($type), '.');
     if (!$this->issetType($type)) {
         throw new SystemException("Could not find type '{$type}' in BlankFile");
     }
     $typeData = $this->getType($type);
     $this->name = $typeData['newFileName'] . $typeData['ext'];
     $this->mimeType = TypeFile::getMimeTypeByFilename($this->name);
     $this->src = $typeData['src'];
     $this->size = IO\File::isFileExists($typeData['src']) ? filesize($typeData['src']) : 0;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:blankfiledata.php


示例11: saveRules

 private static function saveRules($siteId, array $arUrlRewrite)
 {
     $site = SiteTable::getRow(array("filter" => array("LID" => $siteId)));
     $docRoot = $site["DOC_ROOT"];
     if (!empty($docRoot)) {
         $docRoot = IO\Path::normalize($docRoot);
     } else {
         $docRoot = Application::getDocumentRoot();
     }
     $data = var_export($arUrlRewrite, true);
     IO\File::putFileContents($docRoot . "/urlrewrite.php", "<" . "?php\n\$arUrlRewrite=" . $data . ";\n");
     Application::resetAccelerator();
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:13,代码来源:urlrewriter.php


示例12: renderExceptionMessage

 function renderExceptionMessage(\Exception $exception, $debug = false)
 {
     if ($debug) {
         echo ExceptionHandlerFormatter::format($exception, true);
     } else {
         $p = Main\IO\Path::convertRelativeToAbsolute("/error.php");
         if (Main\IO\File::isFileExists($p)) {
             include $p;
         } else {
             $context = Main\Application::getInstance();
             if ($context) {
                 echo Main\Localization\Loc::getMessage("eho_render_exception_message");
             } else {
                 echo "A error occurred during execution of this script. You can turn on extended error reporting in .settings.php file.";
             }
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:18,代码来源:httpexceptionhandleroutput.php


示例13: initScripts

 /**
  * Sets viewport-metadata
  */
 public static function initScripts()
 {
     global $APPLICATION;
     \CJSCore::Init();
     $APPLICATION->AddHeadString("<script type=\"text/javascript\">var mobileSiteDir=\"" . SITE_DIR . "\"; var appVersion = " . self::$apiVersion . ";var platform = \"" . self::$platform . "\";</script>", false, true);
     if (self::$platform == "android") {
         /**
          * This is workaround for android
          * We use console.log() to tell the application about successful loading of this page
          */
         $APPLICATION->AddHeadString("<script type=\"text/javascript\">console.log(\"bxdata://success\")</script>", false, true);
     }
     if (self::getInstance()->getBXScriptSupported()) {
         /**
          * If the application tells us bxscript-feature is available
          * it means that device can load cordova-scripts (including plugins) itself.
          */
         $pgJsFile = "/bitrix/js/mobileapp/__deviceload__/cordova.js";
         $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . $pgJsFile . "\"></script>", false, true);
     } else {
         $pgJsFile = "/bitrix/js/mobileapp/" . self::$platform . "-cordova-" . self::$pgVersion . ".js";
         if (!File::isFileExists(Application::getDocumentRoot() . $pgJsFile)) {
             $pgJsFile = self::$remoteScriptPath . self::$platform . "-cordova-" . self::$pgVersion . ".js";
         }
         $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . \CUtil::GetAdditionalFileURL($pgJsFile) . "\"></script>", false, true);
     }
     $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . \CUtil::GetAdditionalFileURL("/bitrix/js/mobileapp/bitrix_mobile.js") . "\"></script>", false, true);
     $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . \CUtil::GetAdditionalFileURL("/bitrix/js/mobileapp/mobile_lib.js") . "\"></script>", false, true);
     if (self::$platform == "android") {
         $APPLICATION->AddHeadString("<script type=\"text/javascript\">app.bindloadPageBlank();</script>", false, false);
     }
     $APPLICATION->AddHeadString(Mobile::getInstance()->getViewPort());
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:mobile.php


示例14: download

 /**
  * Downloads and saves a file.
  *
  * @param string $url URI to download
  * @param string $filePath Absolute file path
  * @return bool
  */
 public function download($url, $filePath)
 {
     $dir = IO\Path::getDirectory($filePath);
     IO\Directory::createDirectory($dir);
     $file = new IO\File($filePath);
     $handler = $file->open("w+");
     if ($handler !== false) {
         $this->setOutputStream($handler);
         $res = $this->query(self::HTTP_GET, $url);
         fclose($handler);
         return $res;
     }
     return false;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:21,代码来源:httpclient.php


示例15: isset

<?php

/** Bitrix Framework
 * Bitrix vars
 * @global CUser $USER
 * @global CMain $APPLICATION
 */
use Bitrix\Main\IO\File;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
if ($USER->IsAdmin()) {
    $server = isset($_REQUEST['SERVER']) ? trim($_REQUEST['SERVER']) : false;
    $param = isset($_REQUEST['PARAM']) ? trim($_REQUEST['PARAM']) : false;
    $period = isset($_REQUEST['PERIOD']) ? trim($_REQUEST['PERIOD']) : false;
    if ($server && $period && $param) {
        $pathToImages = "/var/lib/munin";
        $path = $pathToImages . '/' . $server . '/' . $server . '/' . $param . '-' . $period . '.png';
        $f = new File($path);
        if ($f->isExists()) {
            header("Content-type: image/png");
            echo $f->getContents();
        }
    }
}
die;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:24,代码来源:image.php


示例16: microtime

            $bCanEdit = false;
        }
        //need fm_lpa for every .php file, even with no php code inside
        if ($bCanEdit && !$USER->CanDoOperation('edit_php') && in_array(GetFileExtension($currentFilePath), GetScriptFileExt()) && !$USER->CanDoFileOperation('fm_lpa', array(SITE_ID, $currentFilePath))) {
            $bCanEdit = false;
        }
        if ($bCanEdit && IsModuleInstalled("fileman") && !($USER->CanDoOperation("fileman_admin_files") && $USER->CanDoOperation("fileman_edit_existent_files"))) {
            $bCanEdit = false;
        }
        if ($bCanEdit) {
            echo $APPLICATION->IncludeStringBefore();
            $BX_GLOBAL_AREA_EDIT_ICON = true;
        }
    }
}
define("START_EXEC_PROLOG_AFTER_2", microtime());
$GLOBALS["BX_STATE"] = "WA";
$APPLICATION->RestartWorkarea(true);
//magically replacing the current file with another one
$event = new Main\Event("main", "OnFileRewrite", array("path" => Main\Context::getCurrent()->getRequest()->getScriptFile()));
$event->send();
foreach ($event->getResults() as $evenResult) {
    if (($result = $evenResult->getParameters()) != '') {
        $file = new Main\IO\File($_SERVER["DOCUMENT_ROOT"] . $result);
        if ($file->isExists()) {
            //only the first result matters
            include $file->getPhysicalPath();
            die;
        }
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:prolog_after.php


示例17: appendContentNonCloud

 private function appendContentNonCloud($fileContent, $startRange, $endRange, $fileSize)
 {
     $file = new IO\File($this->getAbsolutePath());
     if (!$file->isExists()) {
         $this->errorCollection->addOne(new Error('Could not find file', static::ERROR_EXISTS_FILE));
         return false;
     }
     if ($file->putContents($fileContent, $file::APPEND) === false) {
         $this->errorCollection->addOne(new Error('Could not put contents to file', static::ERROR_PUT_CONTENTS));
         return false;
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:tmpfile.php


示例18: transferUri

 private function transferUri($url)
 {
     $url = IO\Path::normalize($url);
     $urlTmp = trim($url, " \t\n\r\v\\/");
     if (empty($urlTmp)) {
         throw new ArgumentNullException("url");
     }
     $ext = IO\Path::getExtension($url);
     if (strtolower($ext) != "php") {
         throw new SystemException("Only php files are allowable for url rewriting");
     }
     $arUrl = explode("/", $url);
     $rootDirName = "";
     while (!empty($arUrl) && ($rootDirName = array_shift($arUrl)) === "") {
     }
     $rootDirName = strtolower(str_replace(".", "", $rootDirName));
     if (in_array($rootDirName, array("bitrix", "local", "upload"))) {
         throw new SystemException(sprintf("Can not use path '%s' for url rewriting", $url));
     }
     if (!IO\Path::validate($url)) {
         throw new SystemException(sprintf("Path '%s' is not valid", $url));
     }
     $absUrl = IO\Path::convertRelativeToAbsolute($url);
     if (!IO\File::isFileExists($absUrl)) {
         throw new SystemException(sprintf("Path '%s' is not found", $url));
     }
     $absUrlPhysical = IO\Path::convertLogicalToPhysical($absUrl);
     global $APPLICATION, $USER, $DB;
     include_once $absUrlPhysical;
     die;
 }
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:application.php


示例19: configureLicenseKey

 /**
  * Sets license key Bitrix CMS.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param string $licenseKey
  */
 protected function configureLicenseKey(InputInterface $input, OutputInterface $output, $licenseKey)
 {
     if (!is_string($licenseKey)) {
         throw new \InvalidArgumentException('Config "licenseKey" must be string type.');
     }
     $licenseFileContent = "<" . "? \$" . "LICENSE_KEY = \"" . EscapePHPString($licenseKey) . "\"; ?" . ">";
     File::putFileContents(Application::getDocumentRoot() . BX_ROOT . '/license_key.php', $licenseFileContent);
 }
开发者ID:notamedia,项目名称:console-jedi,代码行数:15,代码来源:InitCommand.php


示例20: array

			</select>
			<input type="hidden" value="<?php 
echo $paySystem['ACTION_FILE'];
?>
" name="PRIOR_ACTION_FILE">
		</td>
	</tr>
	<tbody id="pay_system_ps_mode">
	<?php 
$psMode = $request->get('PS_MODE') ? $request->get('PS_MODE') : $paySystem['PS_MODE'];
/** @var PaySystem\BaseServiceHandler $className */
$className = PaySystem\Manager::getClassNameFromPath($handlerName);
if (!class_exists($className)) {
    $path = PaySystem\Manager::getPathToHandlerFolder($handler);
    $fullPath = $documentRoot . $path . '/handler.php';
    if ($path && \Bitrix\Main\IO\File::isFileExists($fullPath)) {
        require_once $fullPath;
    }
}
$handlerModeList = array();
if (class_exists($className)) {
    $handlerModeList = $className::getHandlerModeList();
}
if ($handlerModeList) {
    ?>
			<tr>
				<td width="40%" valign="top"><?php 
    echo Loc::getMessage("F_PS_MODE");
    ?>
:</td>
				<td width="60%" valign="top">
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:pay_system_edit.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP IO\Path类代码示例发布时间:2022-05-23
下一篇:
PHP Entity\Query类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap