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


PHP F::File_PutContents方法代码示例

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


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

示例1: CompileTheme

 /**
  * Компилирует тему
  *
  * @param array $aParams Передаваемые параметры
  * @return bool
  */
 public function CompileTheme($aParams, $bDownload = FALSE)
 {
     if (!E::User()) {
         return FALSE;
     }
     $sCompiledStyle = E::ModuleLess()->CompileFile(array(C::Get('path.skins.dir') . 'experience-simple/themes/custom/less/theme.less' => C::Get('path.root.web')), __DIR__ . '/../../../cache/', C::Get('path.skins.dir') . 'experience-simple/themes/custom/css/theme.custom.css.map', $aParams, $bDownload);
     if ($sCompiledStyle) {
         if (!$bDownload || E::IsAdmin()) {
             F::File_PutContents(C::Get('path.skins.dir') . 'experience-simple/themes/custom/css/theme.custom.css', $sCompiledStyle);
         } else {
             $sPath = C::Get('plugin.estheme.path_for_download') . E::UserId() . '/theme.custom.css';
             F::File_PutContents($sPath, $sCompiledStyle);
         }
     }
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:21,代码来源:Estheme.class.php

示例2: 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;
 }
开发者ID:hard990,项目名称:altocms,代码行数:12,代码来源:PackageCss.entity.class.php

示例3: Clean

 /**
  * Clear cache
  *
  * @param string      $sMode
  * @param array       $aTags
  * @param string|null $sCacheType - Type of cache (if null then clear in all cache types)
  *
  * @return  bool
  */
 public function Clean($sMode = Zend_Cache::CLEANING_MODE_ALL, $aTags = array(), $sCacheType = null)
 {
     // Проверим разрешено ли кэширование
     if ($this->_cacheOn($sCacheType)) {
         $aTags = $this->_prepareTags($aTags);
         $bResult = $this->_backendClean($sCacheType, $sMode, $aTags);
     } else {
         $bResult = false;
     }
     F::File_PutContents(C::Get('sys.cache.dir') . self::CHECK_FILENAME, microtime(true));
     return $bResult;
 }
开发者ID:AlexSSN,项目名称:altocms,代码行数:21,代码来源:Cache.class.php

示例4: _log

 /**
  * @param string $sText
  * @param string $sLogFile
  * @param string $sLevel
  *
  * @return bool
  */
 public static function _log($sText, $sLogFile, $sLevel = null)
 {
     if (class_exists('ModuleLogger', false) || class_exists('Loader', false) && Loader::Autoload('ModuleLogger')) {
         // Если загружен модуль Logger, то логгируем ошибку с его помощью
         return E::ModuleLogger()->Dump($sLogFile, $sText, $sLevel);
     } elseif (class_exists('Config', false)) {
         // Если логгера нет, но есть конфиг, то самостоятельно пишем в файл
         $sFile = Config::Get('sys.logs.dir') . $sLogFile;
         if (!$sFile) {
             // Непонятно, куда писать
         } else {
             $sText = '[' . date('Y-m-d H:i:s') . ']' . "\n" . $sText;
             return F::File_PutContents($sFile, $sText, FILE_APPEND | LOCK_EX);
         }
     }
     return false;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:24,代码来源:Func.php

示例5: _saveAssets

 /**
  * Save cache and check-file of current asset pack
  */
 protected function _saveAssets()
 {
     $sCheckFileName = $this->GetAssetsCheckName();
     F::File_PutContents($sCheckFileName, time(), LOCK_EX, true);
     $sCacheFileName = $this->GetAssetsCacheName();
     F::File_PutContents($sCacheFileName, F::Serialize($this->aAssets), LOCK_EX, true);
     F::File_Delete($sCacheFileName . '.tmp');
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:11,代码来源:ViewerAsset.class.php

示例6: SetActivePlugins

 /**
  * Записывает список активных плагинов в файл PLUGINS.DAT
  *
  * @param array|string $aPlugins    Список плагинов
  *
  * @return bool
  */
 public function SetActivePlugins($aPlugins)
 {
     if (!is_array($aPlugins)) {
         $sPlugin = (string) $aPlugins;
         $aPlugins = array($sPlugin => array('id' => $sPlugin, 'dirname' => $sPlugin));
     }
     //$aPlugins = array_unique(array_map('trim', $aPlugins));
     $aSaveData = array(date(';Y-m-d H:i:s'));
     foreach ($aPlugins as $sPlugin => $aPluginInfo) {
         $aSaveData[] = $sPlugin . ' ' . (!empty($aPluginInfo['dirname']) ? $aPluginInfo['dirname'] : $sPlugin) . (!empty($aPluginInfo['name']) ? ' ;' . $aPluginInfo['name'] : '');
     }
     // * Записываем данные в файл PLUGINS.DAT
     $sFile = F::GetPluginsDatFile();
     if (F::File_PutContents($sFile, implode(PHP_EOL, $aSaveData)) !== false) {
         return true;
     }
     return false;
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:25,代码来源:Plugin.class.php

示例7: UploadRemote

 /**
  * Upload remote file by URL
  *
  * @param string $sUrl
  * @param string $sTarget
  * @param string $sDir
  * @param array  $aParams [max_size => «размер в килобайтах»]
  *
  * @return bool
  */
 public function UploadRemote($sUrl, $sTarget = 'default', $sDir = null, $aParams = array())
 {
     $this->nLastError = 0;
     if (!isset($aParams['max_size'])) {
         $aParams['max_size'] = 0;
     } else {
         $aParams['max_size'] = intval($aParams['max_size']);
     }
     $sContent = '';
     if ($aParams['max_size']) {
         $hFile = @fopen($sUrl, 'r');
         if (!$hFile) {
             $this->nLastError = self::ERR_REMOTE_FILE_OPEN;
             return false;
         }
         $nSizeKb = 0;
         while (!feof($hFile) && $nSizeKb <= $aParams['max_size']) {
             $sPiece = fread($hFile, 1024);
             if ($sPiece) {
                 $nSizeKb += strlen($sPiece);
                 $sContent .= $sPiece;
             } else {
                 break;
             }
         }
         fclose($hFile);
         // * Если конец файла не достигнут, значит файл имеет недопустимый размер
         if ($nSizeKb > $aParams['max_size']) {
             $this->nLastError = self::ERR_REMOTE_FILE_MAXSIZE;
             return false;
         }
     } else {
         $sContent = @file_get_contents($sUrl);
         if ($sContent === false) {
             $this->nLastError = self::ERR_REMOTE_FILE_READ;
             return false;
         }
     }
     if ($sContent) {
         $sTmpFile = F::File_UploadUniqname(F::File_GetExtension($sUrl));
         if (!F::File_PutContents($sTmpFile, $sContent)) {
             $this->nLastError = self::ERR_REMOTE_FILE_WRITE;
             return false;
         }
     }
     if (!empty($sTmpFile) && $this->_checkUploadedFile($sTmpFile, $sTarget)) {
         if ($sDir) {
             return $this->MoveTmpFile($sTmpFile, $sDir);
         } else {
             return $sTmpFile;
         }
     }
     return false;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:64,代码来源:Uploader.class.php

示例8: _putCustomCfg

 /**
  * Сохраняет в файловом кеше кастомную конфигурацию
  *
  * @param $aConfig
  * @param $bReset
  */
 protected static function _putCustomCfg($aConfig, $bReset = false)
 {
     if (is_array($aConfig) && ($sFile = self::_checkCustomCfg())) {
         $aConfig['_timestamp_'] = time();
         if (!$bReset) {
             // Объединяем текущую конфигурацию с сохраняемой
             $aOldConfig = self::_getCustomCfg();
             if ($aOldConfig) {
                 $aConfig = F::Array_Merge($aOldConfig, $aConfig);
             }
         }
         F::File_PutContents($sFile, F::Serialize($aConfig));
     }
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:20,代码来源:Config.class.php

示例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;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:31,代码来源:PackageJs.entity.class.php

示例10: _saveAssets

 /**
  * Save cache and check-file of current asset pack
  */
 protected function _saveAssets()
 {
     F::File_PutContents($this->GetAssetsCheckName(), time());
     $sFile = $this->GetAssetsCacheName();
     F::File_PutContents($sFile, F::Serialize($this->aAssets));
     F::File_Delete($sFile . '.tmp');
 }
开发者ID:AlexSSN,项目名称:altocms,代码行数:10,代码来源:ViewerAsset.class.php

示例11: _stageEnd

 /**
  * @param int  $nStage
  * @param bool $bFinal
  */
 protected function _stageEnd($nStage, $bFinal = false)
 {
     $sFile = F::File_GetAssetDir() . '_check/' . $this->GetHash();
     F::File_PutContents($sFile . '.' . $nStage . '.end.tmp', time());
     for ($n = 1; $n <= $nStage; $n++) {
         F::File_Delete($sFile . '.' . $n . '.begin.tmp');
         if ($n < $nStage || $bFinal) {
             F::File_Delete($sFile . '.' . $n . '.end.tmp');
         }
     }
 }
开发者ID:hard990,项目名称:altocms,代码行数:15,代码来源:Package.entity.class.php

示例12: _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;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:32,代码来源:Viewer.class.php

示例13: _write

 /**
  * Writes message to log file
  *
  * @param string $sMsg - message to log
  *
  * @return bool|int
  */
 protected function _write($sMsg)
 {
     $xResult = false;
     // if no filename then nothing to do
     if (!($sFileName = $this->GetFileName())) {
         //throw new Exception("Empty file name for log!");
         return false;
     }
     // if filename equal '-' then wtites message to browser
     if ($sFileName == '-') {
         echo $sMsg . "<br/>\n";
     } else {
         // writes to file
         $sFile = $this->GetFileDir() . $sFileName;
         // file for locking
         $sCheckFileName = $sFile . '.lock';
         if (is_file($sCheckFileName) && !is_writeable($sCheckFileName)) {
             F::SysWarning('Cannot write to file ' . $sCheckFileName);
         } else {
             $fp = @fopen($sCheckFileName, 'c');
             if (!$fp) {
                 // It is not clear what to do here
                 if ($xResult = F::File_PutContents($sFile, $sMsg . "\n", FILE_APPEND | LOCK_EX)) {
                     // Do rotation if need
                     if ($this->GetUseRotate() && $this->GetSizeForRotate()) {
                         $this->_rotate();
                     }
                 }
             } else {
                 // Tries to lock
                 $iTotal = 0;
                 // Check the count of attempts at competitive lock requests
                 for ($iCnt = 0; $iCnt < self::MAX_LOCK_CNT; $iCnt++) {
                     if (flock($fp, LOCK_EX)) {
                         if ($xResult = F::File_PutContents($sFile, $sMsg . "\n", FILE_APPEND | LOCK_EX)) {
                             // Do rotation if need
                             if ($this->GetUseRotate() && $this->GetSizeForRotate()) {
                                 $this->_rotate();
                             }
                         }
                         flock($fp, LOCK_UN);
                         break;
                     } else {
                         $iTotal += self::MAX_LOCK_PERIOD;
                         if ($iTotal >= self::MAX_LOCK_TIME) {
                             break;
                         }
                         usleep(self::MAX_LOCK_PERIOD);
                     }
                 }
                 fclose($fp);
             }
         }
     }
     return $xResult;
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:63,代码来源:Log.entity.class.php

示例14: _putFileCfg

 /**
  * Сохраняет в файловом кеше кастомную конфигурацию
  *
  * @param array $aConfig
  * @param bool  $bReset
  */
 protected static function _putFileCfg($aConfig, $bReset = false)
 {
     if (is_array($aConfig) && ($sFile = self::_checkFileCfg())) {
         if (!$bReset) {
             // Объединяем текущую конфигурацию с сохраняемой
             $aOldConfig = self::_getFileCfg();
             if ($aOldConfig) {
                 $aData = new DataArray($aOldConfig);
                 foreach ($aConfig as $sKey => $xVal) {
                     $aData[$sKey] = $xVal;
                 }
                 $aConfig = $aData->getArrayCopy();
             }
         }
         $aConfig['_timestamp_'] = time();
         $aConfig['_alto_hash_'] = self::_getHash();
         F::File_PutContents($sFile, F::Serialize($aConfig), LOCK_EX);
     }
 }
开发者ID:anp135,项目名称:altocms,代码行数:25,代码来源:Config.class.php


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