本文整理汇总了PHP中F::File_GetContents方法的典型用法代码示例。如果您正苦于以下问题:PHP F::File_GetContents方法的具体用法?PHP F::File_GetContents怎么用?PHP F::File_GetContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F
的用法示例。
在下文中一共展示了F::File_GetContents方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetSkinManifest
/**
* Load skin manifest from XML
*
* @param string $sSkin
* @param string $sSkinDir
*
* @return string|bool
*/
public function GetSkinManifest($sSkin, $sSkinDir = null)
{
if (!$sSkinDir) {
$sSkinDir = Config::Get('path.skins.dir') . $sSkin . '/';
}
if (F::File_Exists($sSkinDir . '/' . self::SKIN_XML_FILE)) {
$sXmlFile = $sSkinDir . '/' . self::SKIN_XML_FILE;
} else {
$sXmlFile = $sSkinDir . '/settings/' . self::SKIN_XML_FILE;
}
if ($sXml = F::File_GetContents($sXmlFile)) {
return $sXml;
}
return null;
}
示例2: EventConfig
public function EventConfig()
{
$sFile = Plugin::GetPath(__CLASS__) . 'config/sphinx-src.conf';
$sText = F::File_GetContents($sFile);
$sPath = F::File_NormPath(Config::Get('plugin.sphinx.path') . '/');
$sDescription = E::ModuleLang()->Get('plugin.sphinx.conf_description', array('path' => $sPath, 'prefix' => Config::Get('plugin.sphinx.prefix')));
$sDescription = preg_replace('/\\s\\s+/', ' ', str_replace("\n", "\n## ", $sDescription));
$sTitle = E::ModuleLang()->Get('plugin.sphinx.conf_title');
$aData = array('{{title}}' => $sTitle, '{{description}}' => $sDescription, '{{db_type}}' => Config::Get('db.params.type') == 'postgresql' ? 'pgsql' : 'mysql', '{{db_host}}' => Config::Get('db.params.host'), '{{db_user}}' => Config::Get('db.params.user'), '{{db_pass}}' => Config::Get('db.params.pass'), '{{db_name}}' => Config::Get('db.params.dbname'), '{{db_port}}' => Config::Get('db.params.port'), '{{db_prefix}}' => Config::Get('db.table.prefix'), '{{db_socket}}' => Config::Get('plugin.sphinx.db_socket'), '{{spinx_prefix}}' => Config::Get('plugin.sphinx.prefix'), '{{spinx_path}}' => $sPath);
$sText = str_replace(array_keys($aData), array_values($aData), $sText);
echo '<pre>';
echo $sText;
echo '</pre>';
exit;
}
示例3: PrepareFile
public function PrepareFile($sFile, $sDestination)
{
$sContents = F::File_GetContents($sFile);
if ($sContents !== false) {
$sContents = $this->PrepareContents($sContents, $sFile, $sDestination);
if (F::File_PutContents($sDestination, $sContents) !== false) {
return $sDestination;
}
}
F::SysWarning('Can not prepare asset file "' . $sFile . '"');
return null;
}
示例4: GetPluginsList
/**
* Получить список плагинов
*
* @param bool $bAll - все плагины (иначе - только активные)
* @param bool $bIdOnly - только Id плагинов (иначе - вся строка с информацией о плагине)
*
* @return array
*/
public static function GetPluginsList($bAll = false, $bIdOnly = true)
{
$sPluginsDatFile = static::GetPluginsDatFile();
if (isset(self::$_aPluginList[$sPluginsDatFile][$bAll])) {
$aPlugins = self::$_aPluginList[$sPluginsDatFile][$bAll];
} else {
$sCommonPluginsDir = static::GetPluginsDir();
$aPlugins = array();
$aPluginsRaw = array();
if ($bAll) {
$aFiles = glob($sCommonPluginsDir . '{*,*/*}/plugin.xml', GLOB_BRACE);
if ($aFiles) {
foreach ($aFiles as $sXmlFile) {
$aPluginInfo = array();
$sXmlText = F::File_GetContents($sXmlFile);
$sDirName = dirname(F::File_LocalPath($sXmlFile, $sCommonPluginsDir));
if (preg_match('/\\<id\\>([\\w\\.\\/]+)\\<\\/id\\>/', $sXmlText, $aMatches)) {
$aPluginInfo['id'] = $aMatches[1];
} else {
$aPluginInfo['id'] = $sDirName;
}
$aPluginInfo['dirname'] = $sDirName;
$aPluginInfo['path'] = dirname($sXmlFile) . '/';
$aPluginInfo['manifest'] = $sXmlFile;
$aPlugins[$aPluginInfo['id']] = $aPluginInfo;
}
}
} else {
if (is_file($sPluginsDatFile) && ($aPluginsRaw = @file($sPluginsDatFile))) {
$aPluginsRaw = array_map('trim', $aPluginsRaw);
$aPluginsRaw = array_unique($aPluginsRaw);
}
if ($aPluginsRaw) {
foreach ($aPluginsRaw as $sPluginStr) {
if (($n = strpos($sPluginStr, ';')) !== false) {
if ($n === 0) {
continue;
}
$sPluginStr = trim(substr($sPluginStr, 0, $n));
}
if ($sPluginStr) {
$aPluginInfo = str_word_count($sPluginStr, 1, '0..9/_');
$aPluginInfo['id'] = $aPluginInfo[0];
if (empty($aPluginInfo[1])) {
$aPluginInfo['dirname'] = $aPluginInfo[0];
} else {
$aPluginInfo['dirname'] = $aPluginInfo[1];
}
$sXmlFile = $sCommonPluginsDir . '/' . $aPluginInfo['dirname'] . '/plugin.xml';
if (is_file($sXmlFile)) {
$aPluginInfo['path'] = dirname($sXmlFile) . '/';
$aPluginInfo['manifest'] = $sXmlFile;
$aPlugins[$aPluginInfo['id']] = $aPluginInfo;
}
}
}
}
}
$aPlugins = self::ExcludeByEnabledMask($aPlugins);
self::$_aPluginList[$sPluginsDatFile][$bAll] = $aPlugins;
}
if ($bIdOnly) {
$aPlugins = array_keys($aPlugins);
}
return $aPlugins;
}
示例5: Prepare
/**
* Prepare current asset pack
*/
public function Prepare()
{
if ($this->_isEmpty()) {
return;
}
$bForcePreparation = Config::Get('compress.css.force') || Config::Get('compress.js.force');
$xData = $this->_checkAssets();
if ($xData) {
if (is_array($xData)) {
if (F::File_GetContents($this->GetAssetsCheckName())) {
// loads assets from cache
$this->aAssets = $xData;
if (!$bForcePreparation) {
return;
}
}
} else {
// assets are making right now
// may be need to wait?
for ($i = 0; $i < self::SLEEP_COUNT; $i++) {
sleep(self::SLEEP_TIME);
$xData = $this->_checkAssets();
if (is_array($xData)) {
$this->aAssets = $xData;
return;
}
}
// something wrong
return;
}
}
// May be assets are not complete
if (!$this->aAssets && $this->aFiles && !$bForcePreparation) {
$bForcePreparation = true;
}
if (!F::File_GetContents($this->GetAssetsCheckName()) || $bForcePreparation) {
// reset assets here
$this->_resetAssets();
$this->aAssets = array();
// Add files & links to assets
foreach ($this->aFiles as $sType => $aData) {
if (isset($aData['files'])) {
$this->AddFilesToAssets($sType, $aData['files']);
}
if (isset($aData['links'])) {
$this->AddLinksToAssets($sType, $aData['links']);
}
}
$nStage = 0;
$bDone = true;
// PreProcess
foreach ($this->aAssets as $oAssetPackage) {
if ($oAssetPackage->PreProcessBegin()) {
$bDone = $bDone && $oAssetPackage->PreProcess();
$oAssetPackage->PreProcessEnd();
}
}
if ($bDone) {
$nStage += 1;
}
// Process
foreach ($this->aAssets as $oAssetPackage) {
if ($oAssetPackage->ProcessBegin()) {
$bDone = $bDone && $oAssetPackage->Process();
$oAssetPackage->ProcessEnd();
}
}
if ($bDone) {
$nStage += 1;
}
// PostProcess
foreach ($this->aAssets as $oAssetPackage) {
if ($oAssetPackage->PostProcessBegin()) {
$bDone = $bDone && $oAssetPackage->PostProcess();
$oAssetPackage->PostProcessEnd();
}
}
if ($bDone) {
$nStage += 1;
}
} else {
$nStage = 3;
}
if ($nStage == 3) {
$this->_saveAssets();
}
}
示例6: EventLogs
/**
* View logs
*/
protected function EventLogs()
{
$this->sMainMenuItem = 'logs';
if ($this->sCurrentEvent == 'logs-sqlerror') {
$sLogFile = Config::Get('sys.logs.dir') . Config::Get('sys.logs.sql_error_file');
} elseif ($this->sCurrentEvent == 'logs-sqllog') {
$sLogFile = Config::Get('sys.logs.dir') . Config::Get('sys.logs.sql_query_file');
} else {
$sLogFile = Config::Get('sys.logs.dir') . F::ERROR_LOGFILE;
}
if (!is_null($this->GetPost('submit_logs_del'))) {
$this->_eventLogsErrorDelete($sLogFile);
}
$sLogTxt = F::File_GetContents($sLogFile);
if ($this->sCurrentEvent == 'logs-sqlerror') {
$this->_setTitle(E::ModuleLang()->Get('action.admin.logs_sql_errors_title'));
$this->SetTemplateAction('logs/sql_errors');
$this->_eventLogsSqlErrors($sLogTxt);
} elseif ($this->sCurrentEvent == 'logs-sqllog') {
$this->_setTitle(E::ModuleLang()->Get('action.admin.logs_sql_title'));
$this->SetTemplateAction('logs/sql_log');
$this->_eventLogsSql($sLogTxt);
} else {
$this->_setTitle(E::ModuleLang()->Get('action.admin.logs_errors_title'));
$this->SetTemplateAction('logs/errors');
$this->_eventLogsErrors($sLogTxt);
}
E::ModuleViewer()->Assign('sLogTxt', $sLogTxt);
}
示例7: GetPluginManifestFrom
/**
* @param string $sPluginXmlFile
*
* @return string|bool
*/
public function GetPluginManifestFrom($sPluginXmlFile)
{
if ($sPluginXmlFile && ($sXml = F::File_GetContents($sPluginXmlFile))) {
return $sXml;
}
return false;
}
示例8: _getCustomCfg
/**
* Читает из файлового кеша кастомную конфигурацию
*
* @param string $sKeyPrefix
*
* @return array
*/
protected static function _getCustomCfg($sKeyPrefix = null)
{
if (($sFile = self::_checkCustomCfg()) && ($sData = F::File_GetContents($sFile))) {
$aConfig = F::Unserialize($sData);
if (is_array($aConfig)) {
return $aConfig;
}
}
$aConfig = array();
return $aConfig;
}
示例9: Process
/**
* @return bool
*/
public function Process()
{
$bResult = true;
foreach ($this->aLinks as $nIdx => $aLinkData) {
if (empty($aLinkData['throw']) && !empty($aLinkData['compress'])) {
$sAssetFile = $aLinkData['asset_file'];
$sExtension = 'min.' . F::File_GetExtension($sAssetFile);
$sCompressedFile = F::File_SetExtension($sAssetFile, $sExtension);
if (!$this->CheckDestination($sCompressedFile)) {
if ($sContents = F::File_GetContents($sAssetFile)) {
$sContents = $this->Compress($sContents);
if (F::File_PutContents($sCompressedFile, $sContents, LOCK_EX, true)) {
F::File_Delete($sAssetFile);
$this->aLinks[$nIdx]['link'] = F::File_SetExtension($this->aLinks[$nIdx]['link'], $sExtension);
}
if (C::Get('compress.js.gzip') && C::Get('compress.js.merge') && C::Get('compress.js.use')) {
// Сохраним gzip
$sCompressedContent = gzencode($sContents, 9);
F::File_PutContents($sCompressedFile . '.gz.js', $sCompressedContent, LOCK_EX, true);
}
}
} else {
$this->aLinks[$nIdx]['link'] = F::File_SetExtension($this->aLinks[$nIdx]['link'], $sExtension);
}
}
}
return $bResult;
}
示例10: _stageBegin
/**
* @param int $nStage
*
* @return bool
*/
protected function _stageBegin($nStage)
{
$sFile = F::File_GetAssetDir() . '_check/' . $this->GetHash();
if ($aCheckFiles = glob($sFile . '.{1,2,3}.begin.tmp', GLOB_BRACE)) {
$sCheckFile = reset($aCheckFiles);
// check time of tmp file
$nTime = filectime($sCheckFile);
if (!$nTime) {
$nTime = F::File_GetContents($sCheckFile);
}
if (time() < $nTime + ModuleViewerAsset::TMP_TIME) {
return false;
}
}
if ($nStage == 2 && ($aCheckFiles = glob($sFile . '.{2,3}.end.tmp', GLOB_BRACE))) {
return false;
} elseif ($nStage == 3 && F::File_Exists($sFile . '.3.end.tmp')) {
return false;
}
return F::File_PutContents($sFile . '.' . $nStage . '.begin.tmp', time());
}
示例11: _autocreateOldTemplate
/**
* @param string $sTplName
*
* @return string|bool
*/
protected function _autocreateOldTemplate($sTplName)
{
$sOldTemplatesDir = $this->_getAutocreateOldTemplatesDir();
if ($sFile = F::File_Exists($sTplName, $sOldTemplatesDir)) {
return $sFile;
}
$aSourceTemplatesDir = array(Config::Get('path.skin.dir') . '/themes/default/layouts');
if ($sTplName == 'header.tpl' || $sTplName == 'footer.tpl') {
if ($sSourceFile = F::File_Exists('default.tpl', $aSourceTemplatesDir)) {
$sSource = F::File_GetContents($sSourceFile);
$sStr1 = "{hook run='content_begin'}";
$sStr2 = "{hook run='content_end'}";
if (stripos($sSource, '<!DOCTYPE') !== false) {
$iPos1 = stripos($sSource, $sStr1);
$iPos2 = stripos($sSource, $sStr2);
$sHeaderSrc = $this->_clearUnclosedBlocks(substr($sSource, 0, $iPos1 + strlen($sStr1)));
$sFooterSrc = $this->_clearUnclosedBlocks(substr($sSource, $iPos2));
F::File_PutContents($sOldTemplatesDir . 'header.tpl', $sHeaderSrc);
F::File_PutContents($sOldTemplatesDir . 'footer.tpl', $sFooterSrc);
}
}
}
if ($sFile = F::File_Exists($sTplName, $sOldTemplatesDir)) {
return $sFile;
}
return false;
}
示例12: _getFileCfg
/**
* Читает из файлового кеша кастомную конфигурацию
*
* @return array
*/
protected static function _getFileCfg()
{
if (($sFile = self::_checkFileCfg()) && ($sData = F::File_GetContents($sFile))) {
$aConfig = F::Unserialize($sData);
if (is_array($aConfig)) {
if (isset($aConfig['_alto_hash_']) && $aConfig['_alto_hash_'] == self::_getHash()) {
return $aConfig;
}
}
}
return array();
}