本文整理汇总了PHP中CFile::GetPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::GetPath方法的具体用法?PHP CFile::GetPath怎么用?PHP CFile::GetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::GetPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeComponent
function executeComponent()
{
$arFilter = array('IBLOCK_ID' => $this->arParams['IBLOCK_ID'], 'ACTIVE' => 'Y');
if (true || $this->StartResultCache()) {
$CIBlockElement = new CIBlockElement();
$CFile = new \CFile();
$aElts = array();
$eltsSelectFields = array_merge(array('ID', 'NAME', 'CODE', 'PREVIEW_PICTURE', 'DETAIL_PICTURE', 'DETAIL_PAGE_URL'), $this->getIBlockProperties($this->arParams['IBLOCK_ID']));
$rsElts = $CIBlockElement->GetList(array('SORT' => 'asc', 'date_active_from' => 'DESC'), $arFilter, false, false, array('ID', 'NAME'));
if (intval($rsElts->SelectedRowsCount())) {
while ($arElt = $rsElts->Fetch()) {
$aElts[] = array('ID' => $arElt['ID'], 'NAME' => $arElt['NAME']);
}
$arElt = $CIBlockElement->GetList(array('SORT' => 'asc', 'ID' => 'DESC'), array_merge($arFilter, array('ID' => $aElts[0]['ID'])), false, false, $eltsSelectFields)->GetNext();
if ($arElt['DETAIL_PICTURE']) {
$arElt['DETAIL_PICTURE'] = $CFile->GetPath($arElt['DETAIL_PICTURE']);
} elseif ($arElt['PREVIEW_PICTURE']) {
$arElt['DETAIL_PICTURE'] = $CFile->GetPath($arElt['PREVIEW_PICTURE']);
}
$arPrice = CPrice::GetList(array(), array("PRODUCT_ID" => $arElt['ID']))->Fetch();
$arElt['PRICE'] = $arPrice['PRICE'];
$this->arResult['ITEMS'] = $aElts;
$this->arResult['ITEM'] = $arElt;
$this->IncludeComponentTemplate();
}
}
}
示例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: src
/**
* Ресурс файла
* @param string $field Название поля для ресурса
* @param mixed $resized Если необходим ресайзер
* @return string Ресурс
*/
public function src($field, $resized = false)
{
if (false === $resized) {
$src['src'] = CFile::GetPath($this->item[$field]);
} else {
$src = CFile::ResizeImageGet($this->item[$field], array("width" => $resized[0], "height" => $resized[1]), BX_RESIZE_IMAGE_EXACT, false);
}
return $src;
}
示例4: getElements
public function getElements($iblock_id)
{
$result = array();
$arSelect = array("ID", "NAME", "PREVIEW_PICTURE");
$arFilter = array("IBLOCK_ID" => $iblock_id, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y");
$res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
$arFields = $ob->GetFields();
$this->elemIcons[$arFields['ID']] = CFile::GetPath($arFields['PREVIEW_PICTURE']);
$result[$arFields['ID']] = $arFields['NAME'];
}
return $result;
}
示例5: generateRow
/**
* {@inheritdoc}
*/
public function generateRow(&$row, $data)
{
$html = '';
if ($this->getSettings('MULTIPLE')) {
} else {
$path = \CFile::GetPath($data[$this->code]);
$rsFile = \CFile::GetByID($data[$this->code]);
$file = $rsFile->Fetch();
if ($path) {
$html = '<a href="' . $path . '" >' . $file['FILE_NAME'] . ' (' . $file['FILE_DESCRIPTION'] . ')' . '</a>';
}
$row->AddViewField($this->code, $html);
}
}
示例6: getValueToDb
/**
* Возвращает значение для записи в базу данных
* @return mixed
*/
public function getValueToDb()
{
$val = $this->getValue();
if (!empty($val['error'])) {
return null;
}
$return = null;
if (is_numeric($val)) {
if ($this->getParam('FROM_MULTIPLE')) {
$return['VALUE'] = \CFile::MakeFileArray(\CFile::GetPath($val));
} else {
$return = null;
}
} elseif (is_array($val) && isset($val['tmp_name'])) {
$ext = pathinfo($val['tmp_name'], PATHINFO_EXTENSION);
if ($ext === '' && !empty($val['name'])) {
$oldName = file_exists($val['tmp_name']) ? $val['tmp_name'] : $_SERVER['DOCUMENT_ROOT'] . $val['tmp_name'];
/* feature 24/11/2016, add exceptions if not exists file */
if (!file_exists($oldName)) {
throw new \Exception('bxar: Doesn\'t exists file');
}
$newName = dirname($oldName) . '/f_' . time() . mt_rand() . $val['name'];
if (file_exists($newName) || !rename($oldName, $newName)) {
throw new \Exception('bxar: Can\'t upload file');
}
$val['tmp_name'] = $newName;
}
if ($this->getParam('ID') !== null) {
$val = ['VALUE' => $val];
} else {
$val['del'] = 'Y';
}
$return = $val;
} elseif (file_exists($val)) {
$return = \CFile::MakeFileArray($val);
$return['del'] = 'Y';
$return['module'] = 'iblock';
} elseif (strpos($val, 'http://') === 0 && ($content = @file_get_contents($val)) !== false) {
$extension = pathinfo($val, PATHINFO_EXTENSION);
$temp = tempnam(sys_get_temp_dir(), 'TUX') . ($extension ? '.' . $extension : '');
file_put_contents($temp, $content);
$return = \CFile::MakeFileArray($temp);
$return['del'] = 'Y';
$return['module'] = 'iblock';
} else {
$return = array('del' => 'Y');
}
return $return;
}
示例7: __construct
public function __construct(array $init = array())
{
$this->_id = isset($init['id']) ? $init['id'] : '';
$this->_name = isset($init['name']) ? $init['name'] : '';
$this->_detailText = isset($init['detailText']) ? $init['detailText'] : '';
$this->_dateActiveFrom = isset($init['dateActiveFrom']) ? $init['dateActiveFrom'] : '';
$this->_previewText = isset($init["previewText"]) ? $init['previewText'] : '';
$this->_code = isset($init["code"]) ? $init['code'] : '';
$this->_previewImgID = isset($init["previewImgID"]) ? $init['previewImgID'] : '';
$this->_SectionName = isset($init['SectionName']) ? $init['SectionName'] : null;
if (isset($init['photoGalleryID'])) {
$this->_articleMapper = new ArticleMapper();
$imagesID = $this->_articleMapper->getByIblockID(5, array(), (int) $init['photoGalleryID']);
$images = array();
foreach ($imagesID as $imageID) {
$imagePath = \CFile::GetPath((int) $imageID->previewImgID);
$image = new NSImage\Image((int) $imageID->previewImgID);
array_push($images, $image);
}
$this->_imageGallery = $images;
}
}
示例8: wfIBSearchElementsByProp
function wfIBSearchElementsByProp($IBLOCK_ID = false, $prop = array(), $fields = array(), $limit = 0)
{
if (empty($prop)) {
return false;
}
$arOrder = array("SORT" => "ASC");
if (!empty($IBLOCK_ID)) {
$arFilter["IBLOCK_ID"] = $IBLOCK_ID;
}
$arFilter["ACTIVE"] = "Y";
$arFilter = array_merge($arFilter, $prop);
$arSelect = array("ID", "IBLOCK_ID", "NAME", "DETAIL_PAGE_URL", "PREVIEW_PICTURE", "PREVIEW_TEXT");
if (!empty($fields)) {
$arSelect = array_merge($arSelect, $fields);
}
$arGroupBy = false;
if ($limit > 0) {
$arNavStartParams = array("nTopCount" => $limit);
} else {
$arNavStartParams = false;
}
$elm = CIBlockElement::GetList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelect);
$result = array();
while ($el = $elm->GetNext()) {
$array = array("NAME" => $el["NAME"], "URL" => $el["DETAIL_PAGE_URL"], "ID" => $el["ID"], "TEXT" => $el["PREVIEW_TEXT"]);
$array["IMAGE_P"] = CFile::GetPath($el["PREVIEW_PICTURE"]);
foreach ($fields as $value) {
if (substr_count($value, "PROPERTY_") > 0) {
$array[str_replace("PROPERTY_", "", $value)] = $el[$value . "_VALUE"];
} else {
$array[$value] = $el[$value];
}
}
$result[] = $array;
}
return $result;
}
示例9:
</div>
<div class="row">
<div class="info-block">
<p class="header">Email</p>
<p class="block-info">
<a href="mailto:<?=$arResult["PROPERTIES"]["EMAIL"]["~VALUE"]?>"><?=$arResult["PROPERTIES"]["EMAIL"]["~VALUE"]?></a>
</p>
</div>
<div class="info-block">
<p class="header">Режим работы </p>
<p class="block-info"><?=$arResult["PROPERTIES"]["WORK"]["~VALUE"]?></p>
</div>
</div>
</div>
</div>
<div class="howto-find-wrapper">
<p class="find-header">Как нас найти</p>
<aside>
<div class="salon-route-cnt">
<img src="<?=CFile::GetPath($arResult["PROPERTIES"]["WHERE"]["VALUE"])?>" alt=""/>
</div>
</aside>
<div class="salon-route-info">
<?=$arResult["~DETAIL_TEXT"]?>
<?if ($arResult["PROPERTIES"]["LAT"]["VALUE"] && $arResult["PROPERTIES"]["LONG"]["VALUE"]):?>
<p><a class="btn important js-show-on-map" href="#map" onclick="ga('send', 'event', 'show-map', 'open');">Показать на карте</a></p>
<div class="fbx-content" id="map" data-lat="<?=$arResult["PROPERTIES"]["LAT"]["VALUE"]?>" data-long="<?=$arResult["PROPERTIES"]["LONG"]["VALUE"]?>"></div>
<?endif?>
</div>
</div>
</div>
示例10: array
<div class="info-block-text"><?php
echo $arEvent["PREVIEW_TEXT"];
?>
</div>
</div>
<?php
}
?>
</div>
<!-- Правый блок с текстом и каментами -->
<div class="right-block"><div class="right-block-inner">
<?php
/*echo "<xmp>"; print_r($arEvent); echo "</xmp>";*/
?>
<img src="<?php
echo CFile::GetPath($arEvent["DETAIL_PICTURE"]);
?>
" width="540">
<div class="like-menu">
<?php
$res_like = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 6, "PROPERTY_LIKE" => $arEvent['ID'], "PROPERTY_USER" => $USER->GetID()), array());
$GLOBALS['gl_active'] = $res_like;
$GLOBALS['gl_like_id'] = "like_post_" . $arEvent["ID"];
$GLOBALS['gl_like_numm'] = intval($arEvent["PROPERTIES"]["LIKES"]["VALUE"]);
$GLOBALS['gl_like_param'] = "event_id";
$GLOBALS['gl_like_js'] = $GLOBALS['gl_like_js'] == 1 ? 0 : 1;
$GLOBALS['gl_like_url'] = "/group/events/like_event.php";
$APPLICATION->IncludeComponent("bitrix:main.include", "", array("AREA_FILE_SHOW" => "file", "PATH" => "/like.php"));
?>
<div class="comments-wrap">
<div class="comments-icon"></div>
示例11: str_replace
if ($arSection = $section->GetNext())
$detailURL = str_replace('#SECTION_CODE#', $arSection['CODE'], $detailURL);
}
if ($arParams['IMAGE'] == 'NOT_SHOW')
$image = '';
elseif ($arParams['IMAGE'] == 'PREVIEW_PICTURE')
$image = CFile::GetPath($arElement['PREVIEW_PICTURE']);
elseif ($arParams['IMAGE'] == 'DETAIL_PICTURE')
$image = CFile::GetPath($arElement['DETAIL_PICTURE']);
else
{
$db_props = CIBlockElement::GetProperty($arElement['IBLOCK_ID'], $arElement['ID'], array("sort" => "asc"), Array("CODE" => $arParams['IMAGE']));
if ($arProps = $db_props->Fetch())
$image = CFile::GetPath($arProps["VALUE"]);
else
$image = '';
}
$arResult['ITEMS'][] = array(
'ELEMENT_ID' => $arElement['ID'],
'ELEMENT_NAME' => $arElement['NAME'],
'DETAIL_PAGE_URL' => $detailURL,
'IMAGE' => $image,
'COMMENTS_COUNT' => $arRes['COMMENTS_COUNT']
);
}
}
$this->IncludeComponentTemplate();
}
示例12: getImgPathList
private static function getImgPathList()
{
$dbRes = PaySystemServiceTable::getList(array('select' => array('ID', 'PAYSYS_LOGOTIP' => 'ACTION.LOGOTIP')));
$paySystems = $dbRes->fetchAll();
$logotypes = array('/bitrix/images/sale/nopaysystem.gif');
foreach ($paySystems as $paySystem) {
if (empty($paySystem['PAYSYS_LOGOTIP'])) {
$logotypes[$paySystem['ID']] = $logotypes[0];
} else {
$logotypes[$paySystem['ID']] = \CFile::GetPath($paySystem['PAYSYS_LOGOTIP']);
}
}
return $logotypes;
}
示例13: array
'STYLE' => 'col l3',
'IMG_URL' => $URL,
'LINK' => $arBanner[0]['PROPERTY_LINK_VALUE'],
);
$elem = CBannerGrid::getBannerGrid(7);
$arBanner = CBannerGrid::getElementIblockBanner($elem[0]['BG_IDBANERS']);
$URL = CFile::GetPath($arBanner[0]['PREVIEW_PICTURE']);
$arResult[6] = array(
'SIZE' => 'small',
'NUM' => 2,
'SIZE_DIV' => 'small',
'STYLE' => 'col l3',
'IMG_URL' => $URL,
'LINK' => $arBanner[0]['PROPERTY_LINK_VALUE'],
);
$elem = CBannerGrid::getBannerGrid(8);
$arBanner = CBannerGrid::getElementIblockBanner($elem[0]['BG_IDBANERS']);
$URL = CFile::GetPath($arBanner[0]['PREVIEW_PICTURE']);
$arResult[7] = array(
'SIZE' => 'big',
'SIZE_DIV' => 'big',
'STYLE' => 'col l6',
'IMG_URL' => $URL,
'LINK' => $arBanner[0]['PROPERTY_LINK_VALUE'],
);
$this->IncludeComponentTemplate();
示例14: getResultJSON
}
getResultJSON($log);
}
if ($_REQUEST["log"] !== "read" && $_REQUEST["log"] !== "write") {
getResultJSON(array("status" => "ERROR", "status_msg" => "NO DATA"));
}
}
/**
Показ промо
*/
if ($_REQUEST["mode"] == "promo") {
if (!$USER->IsAuthorized()) {
exit;
}
$promo = CIBlockElement::GetProperty(18, 763)->GetNext();
getResultJSON(array("status" => "OK", "status_msg" => "PROMO", "url_list" => array("http://" . SITE_SERVER_NAME . CFile::GetPath($promo["VALUE"])), "filetime" => array($promo["TIMESTAMP_X"])));
}
/**
Добавление нового контакта
*/
if ($_REQUEST["mode"] == "new_contact") {
if (!$USER->IsAuthorized()) {
exit;
}
$json = json_decode(file_get_contents('php://input'), true);
if (!isValidJSON($json)) {
exit;
}
$contact_type = array(1 => 28, 2 => 29, 3 => 30, 4 => 31, 5 => 32, 6 => 45);
$status = array("Y" => 1, "N" => 0);
foreach ($json as $key => $val) {
示例15: elseif
?>
">closed</a>
<div class="item-form-holder">
<div class="holder">
<a href="<?php
echo $arItem["DETAIL_PAGE_URL"];
?>
">
<div class="image">
<?php
if (strlen($arItem["PREVIEW_PICTURE_SRC"]) > 0) {
$url = $arItem["PREVIEW_PICTURE_SRC"];
} elseif (strlen($arItem["DETAIL_PICTURE_SRC"]) > 0) {
$url = $arItem["DETAIL_PICTURE_SRC"];
} elseif (!empty($arItem["~PROPERTY_MORE_PHOTO_VALUE"])) {
$url = CFile::GetPath(reset(explode(",", $arItem["~PROPERTY_MORE_PHOTO_VALUE"])));
} else {
$url = $templateFolder . "/images/no_photo.png";
}
?>
<img src="<?php
echo $url;
?>
" width="109" />
</div>
</a>
<div class="title">
<h2><a class="name" href="<?php
echo $arItem["DETAIL_PAGE_URL"];
?>
"><?php