本文整理汇总了PHP中Includes\Utils\FileManager::read方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::read方法的具体用法?PHP FileManager::read怎么用?PHP FileManager::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\FileManager
的用法示例。
在下文中一共展示了FileManager::read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeCallToSourceFile
/**
* Modify class source
*
* @param \Includes\Decorator\DataStructure\Graph\Classes $node Current node
*
* @return void
*/
protected function writeCallToSourceFile(\Includes\Decorator\DataStructure\Graph\Classes $node)
{
$path = \Includes\Decorator\ADecorator::getCacheClassesDir() . $node->getPath();
$content = \Includes\Utils\FileManager::read($path);
$content .= PHP_EOL . '// Call static constructor' . PHP_EOL;
$content .= '\\' . $node->getClass() . '::' . static::STATIC_CONSTRUCTOR_METHOD . '();';
\Includes\Utils\FileManager::write($path, $content);
}
示例2: getCounter
public static function getCounter()
{
$data = \Includes\Utils\FileManager::read(static::getFilePath());
if ($data) {
$data = substr($data, strlen('; <' . '?php /*' . PHP_EOL), strlen('; */ ?' . '>') * -1);
$data = unserialize($data);
}
return $data && is_array($data) && isset($data['count']) ? intval($data['count']) : 0;
}
示例3: getClassesTree
/**
* Return classes tree
*
* @param boolean $create Flag OPTIONAL
*
* @return \Includes\Decorator\DataStructure\Graph\Classes
*/
public static function getClassesTree($create = true)
{
if (!isset(static::$classesTree) && $create) {
if (\Includes\Utils\FileManager::isFileReadable(static::getClassesHashPath())) {
$data = unserialize(\Includes\Utils\FileManager::read(static::getClassesHashPath()));
static::$classesTree = array_pop($data);
} else {
static::$classesTree = \Includes\Decorator\Utils\Operator::createClassesTree();
}
}
return static::$classesTree;
}
示例4: getDBSchema
/**
* Get schema
*
* @return array
*/
public static function getDBSchema()
{
if (!isset(static::$schema)) {
$path = static::getDBSchemaFilePath();
if (\Includes\Utils\FileManager::isFileReadable($path)) {
$content = \Includes\Utils\FileManager::read($path);
if ($content) {
static::$schema = explode(';', $content);
}
}
}
return static::$schema;
}
示例5: getAnnotatedTemplates
/**
* Return templates list
*
* @return array
*/
protected function getAnnotatedTemplates()
{
if (!isset(static::$annotatedTemplates)) {
static::$annotatedTemplates = array();
static::$inheritedTemplates = array();
foreach ($this->getTemplateFileIterator()->getIterator() as $path => $data) {
$data = \Includes\Decorator\Utils\Operator::getTags(\Includes\Utils\FileManager::read($path, true), array(static::TAG_LIST_CHILD, static::TAG_INHERITED_LIST_CHILD));
if (isset($data[static::TAG_LIST_CHILD])) {
$this->addTags($data[static::TAG_LIST_CHILD], $path);
}
if (isset($data[static::TAG_INHERITED_LIST_CHILD])) {
static::$inheritedTemplates[] = $path;
}
}
}
return static::$annotatedTemplates;
}
示例6: getChain
/**
* Return templates chain
*
* @return array
*/
protected function getChain()
{
$result = array();
/** @var \XLite\Core\Layout $layout */
$layout = \XLite\Core\Layout::getInstance();
$shortPath = $this->getValue();
$files = array();
foreach ($layout->getSkinPaths(\XLite::CUSTOMER_INTERFACE) as $path) {
$fullPath = $path['fs'] . LC_DS . $shortPath;
if (file_exists($fullPath) && is_file($fullPath)) {
array_unshift($files, $fullPath);
}
}
foreach ($files as $fullPath) {
$result[substr($fullPath, strlen(LC_DIR_SKINS))] = htmlspecialchars(\Includes\Utils\FileManager::read($fullPath));
}
return $result;
}
示例7: doActionUninstall
/**
* Uninstall module
*
* @return void
*/
protected function doActionUninstall()
{
$module = $this->getModule();
if ($module) {
$pack = new \XLite\Core\Pack\Module($module);
$dirs = $pack->getDirs();
$nonWritableDirs = array();
// Check permissions
foreach ($dirs as $dir) {
if (!\Includes\Utils\FileManager::isDirWriteable($dir)) {
$nonWritableDirs[] = \Includes\Utils\FileManager::getRelativePath($dir, LC_DIR_ROOT);
}
}
$params = array('name' => $module->getActualName());
if (empty($nonWritableDirs)) {
$yaml = \Includes\Utils\FileManager::read(\Includes\Utils\ModulesManager::getModuleYAMLFile($module->getAuthor(), $module->getName()));
// Remove from FS
foreach ($dirs as $dir) {
\Includes\Utils\FileManager::unlinkRecursive($dir);
}
// Disable this and depended modules
\Includes\Utils\ModulesManager::disableModule($module->getActualName());
\Includes\Utils\ModulesManager::removeModuleFromDisabledStructure($module->getActualName());
// Remove from DB
\XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->delete($module);
if ($module->getModuleID()) {
$message = 'A DB error occured while uninstalling the module "{{name}}"';
$this->showError(__FUNCTION__, $message, $params);
} else {
if (!empty($yaml)) {
\XLite\Core\Database::getInstance()->unloadFixturesFromYaml($yaml);
}
$message = 'The module "{{name}}" has been uninstalled successfully';
$this->showInfo(__FUNCTION__, $message, $params);
}
// To restore previous state
\XLite\Core\Marketplace::getInstance()->saveAddonsList(0);
// Flag to rebuild cache
\XLite::setCleanUpCacheFlag(true);
} else {
$message = 'Unable to delete module "{{name}}" files: some dirs have no writable permissions: {{dirs}}';
$this->showError(__FUNCTION__, $message, $params + array('dirs' => implode(', ', $nonWritableDirs)));
}
}
}
示例8: prepareJSCache
/**
* Prepares JS cache to use
*
* @param array $resource Array with JS file data
*
* @return string
*/
protected function prepareJSCache($resource)
{
$filePath = $resource['file'];
$minFilePath = str_replace(LC_DIR_SKINS, static::getMinifiedCacheDir(static::RESOURCE_JS), $filePath);
$minFilePath = dirname($minFilePath) . LC_DS . basename($minFilePath, '.js') . '.min.js';
$minified = false;
// Get file content
if (\Includes\Utils\FileManager::isFileReadable($minFilePath)) {
$data = \Includes\Utils\FileManager::read($minFilePath);
$minified = true;
} else {
$data = \Includes\Utils\FileManager::read($filePath);
}
$noMinify = !empty($resource['no_minify']) || !empty($resource['no-minify']);
if (!$minified && !$noMinify && strpos(basename($filePath), '.min.js') == false) {
// Minify js content
$data = $this->minifyJS($data, $filePath);
\Includes\Utils\FileManager::write($minFilePath, $data);
}
$data = trim($data);
$data = preg_replace('/\\)$/S', ');', $data);
return $data ? PHP_EOL . '/* AUTOGENERATED: ' . basename($filePath) . ' */' . PHP_EOL . $data . ';' : '';
}
示例9: sendNotification
/**
* Send email notification to administrator about access key
*
* @param boolean $keyChanged is access key was changed
*
* @return void
*/
public static function sendNotification($keyChanged = false)
{
if (!\Includes\Decorator\Utils\CacheManager::isRebuildNeeded(\Includes\Decorator\Utils\CacheManager::STEP_THIRD)) {
// Send email notification
\XLite\Core\Mailer::sendSafeModeAccessKeyNotification(\Includes\Utils\FileManager::read(static::getAccessKeyFileName()), $keyChanged);
}
}
示例10: init
/**
* Set new file for compile
*
* @param string $file Template to compile
*
* @return void
*/
protected function init($file)
{
$this->file = $file;
$this->source = \Includes\Utils\FileManager::read($file);
$this->urlRewrite = array('images' => array($this, 'rewriteImageURL'));
}
示例11: download
/**
* Download pack
*
* @param \XLite\Core\Pack\APack $pack Files to pack
* @param boolean $compress Flag OPTIONAL
*
* @return void
*/
protected static function download(\XLite\Core\Pack\APack $pack, $compress = true)
{
if (!\Includes\Utils\FileManager::isDir(LC_DIR_TMP)) {
\Includes\Utils\FileManager::mkdir(LC_DIR_TMP);
}
if (!\Includes\Utils\FileManager::isDirWriteable(LC_DIR_TMP)) {
\Includes\ErrorHandler::fireError('Directory "' . LC_DIR_TMP . '" is not writeable');
}
$path = LC_DIR_TMP . $pack->getName() . '.tar';
$phar = static::pack($path, $pack->getDirectoryIterator(), $pack->getMetadata(), $compress);
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="' . basename($path) . '"');
header('Content-Length: ' . filesize($path));
echo \Includes\Utils\FileManager::read($path);
\Includes\Utils\FileManager::deleteFile($path);
exit(0);
}
示例12: getFileContent
/**
* Get file content
*
* @return string
*/
public function getFileContent()
{
return \Includes\Utils\FileManager::read($this->getFileName());
}
示例13: getLESSResourceHash
/**
* Get LESSResourceHash
*
* @param array $lessFiles LESS files structures array
* @param boolean $original Get original path OPTIONAL
*
* @return array
*/
protected function getLESSResourceHash($lessFiles, $original = false)
{
if (!isset($this->LESSResourceHash)) {
$data = \Includes\Utils\FileManager::read(static::getHashFilePath());
if ($data) {
$data = substr($data, strlen('; <' . '?php /*' . PHP_EOL), strlen('; */ ?' . '>') * -1);
$data = unserialize($data);
}
$this->LESSResourceHash = $data && is_array($data) ? $data : array();
}
$path = $this->getCSSResource($lessFiles, $original, true);
return isset($this->LESSResourceHash[$path]) && is_array($this->LESSResourceHash[$path]) ? $this->LESSResourceHash[$path] : array();
}
示例14: getModelObjectValue
/**
* Retrieve property from the model object
*
* @param mixed $name Field/property name
*
* @return mixed
*/
protected function getModelObjectValue($name)
{
switch ($name) {
case 'body':
$value = '';
$localPath = '';
if (\XLite\Core\Request::getInstance()->template) {
$localPath = \XLite\Core\Request::getInstance()->template;
} elseif ($this->getModelObject()->getId()) {
$localPath = $this->getModelObjectValue('template');
}
if ($localPath) {
$model = $this->getModelObject();
$fullPath = $this->getFullPathByLocalPath($localPath, $model->getId() ? 'theme_tweaker/default' : null);
$value = \Includes\Utils\FileManager::read($fullPath);
}
break;
default:
$value = parent::getModelObjectValue($name);
break;
}
return $value;
}
示例15: getBody
/**
* Get body
*
* @return string
*/
public function getBody()
{
if ($this->isURL()) {
$body = \XLite\Core\Operator::getURLContent($this->getPath());
} else {
$body = \Includes\Utils\FileManager::read($this->getStoragePath());
}
return $body;
}