本文整理汇总了PHP中F::File_LocalDir方法的典型用法代码示例。如果您正苦于以下问题:PHP F::File_LocalDir方法的具体用法?PHP F::File_LocalDir怎么用?PHP F::File_LocalDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F
的用法示例。
在下文中一共展示了F::File_LocalDir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_asset
/**
* Plugin for Smarty
* Returns URL for skin asset file
*
* @param array $aParams
* @param Smarty_Internal_Template $oSmartyTemplate
*
* @return string
*/
function smarty_function_asset($aParams, $oSmartyTemplate)
{
if (empty($aParams['skin']) && empty($aParams['file'])) {
trigger_error('Asset: missing "file" parameter', E_USER_WARNING);
return '';
}
if (isset($aParams['file'])) {
if (stripos($aParams['file'], 'http://') === 0 || stripos($aParams['file'], 'https://') === 0 || stripos($aParams['file'], 'http://') === 0) {
$sUrl = $aParams['file'];
} else {
$sSkin = !empty($aParams['skin']) ? $aParams['skin'] : E::ModuleViewer()->GetConfigSkin();
// File name has full local path
if (F::File_LocalDir($aParams['file'])) {
$sFile = $aParams['file'];
} else {
// Need URL to asset file
if (isset($aParams['theme'])) {
if (is_bool($aParams['theme'])) {
$sTheme = E::ModuleViewer()->GetConfigTheme();
} else {
$sTheme = $aParams['theme'];
}
} else {
$sTheme = '';
}
if ($sTheme) {
$sTheme = 'themes/' . $sTheme . '/';
}
if (isset($aParams['plugin'])) {
$sFile = Plugin::GetTemplateFile($aParams['plugin'], $aParams['file']);
} else {
$sFile = Config::Get('path.skins.dir') . '/' . $sSkin . '/' . $sTheme . $aParams['file'];
}
}
if (isset($aParams['prepare'])) {
$sAssetName = empty($aParams['asset']) ? $sFile : $aParams['asset'];
// Грязноватый хак, но иначе нам не получить ссылку
$aFileData = array($sFile => array('name' => md5($sFile), 'prepare' => true));
/** @var ModuleViewerAsset $oLocalViewerAsset */
$oLocalViewerAsset = new ModuleViewerAsset();
$oLocalViewerAsset->AddFiles(F::File_GetExtension($sFile, true), $aFileData, $sAssetName);
$oLocalViewerAsset->Prepare();
//$sUrl = $oLocalViewerAsset->AssetFileUrl(F::File_NormPath($sFile));
$aLinks = $oLocalViewerAsset->GetPreparedAssetLinks();
$sUrl = reset($aLinks);
} else {
$sUrl = E::ModuleViewerAsset()->File2Link($sFile, 'skin/' . $sSkin . '/');
}
}
} else {
// Need URL to asset dir
$sUrl = E::ModuleViewer()->GetAssetUrl() . 'skin/' . $aParams['skin'] . '/';
}
return $sUrl;
}
示例2: smarty_function_asset
/**
* Plugin for Smarty
* Returns URL for skin asset file
*
* @param array $aParams
* @param Smarty_Internal_Template $oSmartyTemplate
*
* @return string
*/
function smarty_function_asset($aParams, $oSmartyTemplate)
{
if (empty($aParams['skin']) && empty($aParams['file'])) {
trigger_error('Asset: missing "file" parametr', E_USER_WARNING);
return '';
}
if (isset($aParams['file'])) {
if (stripos($aParams['file'], 'http://') === 0 || stripos($aParams['file'], 'https://') === 0 || stripos($aParams['file'], 'http://') === 0) {
$sUrl = $aParams['file'];
} else {
if (F::File_LocalDir($aParams['file'])) {
$sFile = $aParams['file'];
} else {
// Need URL to asset file
if (empty($aParams['skin'])) {
$sSkin = E::ModuleViewer()->GetConfigSkin();
} else {
$sSkin = $aParams['skin'];
}
if (isset($aParams['theme'])) {
if (is_bool($aParams['theme'])) {
$sTheme = E::ModuleViewer()->GetConfigTheme();
} else {
$sTheme = $aParams['theme'];
}
} else {
$sTheme = '';
}
if ($sTheme) {
$sTheme = 'themes/' . $sTheme . '/';
}
if (isset($aParams['plugin'])) {
$sFile = Plugin::GetTemplateFile($aParams['plugin'], $aParams['file']);
} else {
$sFile = Config::Get('path.skins.dir') . '/' . $sSkin . '/' . $sTheme . $aParams['file'];
}
}
if (isset($aParams['prepare'])) {
/** @var ModuleViewerAsset $oLocalViewerAsset */
$oLocalViewerAsset = new ModuleViewerAsset();
$oLocalViewerAsset->AddFiles(F::File_GetExtension($sFile, true), array($sFile));
$oLocalViewerAsset->Prepare();
$sUrl = $oLocalViewerAsset->AssetFileUrl(F::File_NormPath($sFile));
} else {
$sUrl = E::ModuleViewerAsset()->File2Link($sFile, 'skin/' . $sSkin . '/');
}
}
} else {
// Need URL to asset dir
$sUrl = E::ModuleViewer()->GetAssetUrl() . 'skin/' . $aParams['skin'] . '/';
}
return $sUrl;
}
示例3: PrepareContents
public function PrepareContents($sContents, $sSource)
{
if ($sContents) {
$sContents = $this->_convertUrlsInCss($sContents, dirname($sSource) . '/');
if (C::Get('compress.css.use')) {
$sFile = F::File_LocalDir($sSource);
$sContents = '/*[' . $this->sMarker . ' ' . $sFile . ' begin]*/' . PHP_EOL . $sContents . PHP_EOL . '/*[' . $this->sMarker . ' end]*/' . PHP_EOL;
}
}
return $sContents;
}
示例4: SetFile
/**
* Sets full dir path of resource
*
* @param $sFile
*/
public function SetFile($sFile)
{
if ($sFile) {
if ($sPathDir = F::File_LocalDir($sFile)) {
// Сохраняем относительный путь
$this->SetPathFile('@' . $sPathDir);
if (!$this->GetPathUrl()) {
$this->SetUrl(F::File_Dir2Url($sFile));
}
} else {
// Сохраняем абсолютный путь
$this->SetPathFile($sFile);
}
$this->SetLink(false);
if (!$this->GetStorage()) {
$this->SetStorage('file');
}
} else {
$this->SetPathFile(null);
}
$this->RecalcHash();
}
示例5: _checkRequiredDirs
/**
* Check required dirs
*/
protected static function _checkRequiredDirs()
{
$sDir = Config::Get('path.dir.app');
if (!$sDir) {
die('Application directory not defined');
} elseif (!F::File_CheckDir($sDir, false)) {
die('Application directory "' . F::File_LocalDir(Config::Get('path.dir.app')) . '" is not exist');
}
$sDir = Config::Get('path.tmp.dir');
if (!$sDir) {
die('Directory for temporary files not defined');
} elseif (!F::File_CheckDir($sDir, true)) {
die('Directory for temporary files "' . $sDir . '" does not exist');
} elseif (!is_writeable($sDir)) {
die('Directory for temporary files "' . F::File_LocalDir($sDir) . '" is not writeable');
}
$sDir = Config::Get('path.runtime.dir');
if (!$sDir) {
die('Directory for runtime files not defined');
} elseif (!F::File_CheckDir($sDir, true)) {
die('Directory for runtime files "' . $sDir . '" does not exist');
} elseif (!is_writeable($sDir)) {
die('Directory for runtime files "' . F::File_LocalDir($sDir) . '" is not writeable');
}
}
示例6: PrepareContents
/**
* Обработка контента
*
* @param string $sContents
* @param string $sSource
*
* @return string
*/
public function PrepareContents($sContents, $sSource)
{
if (C::Get('compress.js.use')) {
$sFile = F::File_LocalDir($sSource);
$sContents = '/*[' . $this->sMarker . ' ' . $sFile . ' begin]*/' . PHP_EOL . $sContents . PHP_EOL . '/*[' . $this->sMarker . ' end]*/' . PHP_EOL;
}
return $sContents;
}