本文整理汇总了PHP中Includes\Utils\FileManager类的典型用法代码示例。如果您正苦于以下问题:PHP FileManager类的具体用法?PHP FileManager怎么用?PHP FileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getStoreFileSystemRoot
/**
* Get valid file system storage root
*
* @return string
*/
protected function getStoreFileSystemRoot()
{
$shipments = $this->getLink()->getManifest()->getShipments();
$path = parent::getStoreFileSystemRoot() . $shipments[0]->getParcel()->getOrder()->getOrderId() . LC_DS;
\Includes\Utils\FileManager::mkdirRecursive($path);
return $path;
}
开发者ID:kewaunited,项目名称:xcart,代码行数:12,代码来源:Storage.php
示例2: doActionCleanAggregationCache
/**
* Clean aggregation cache directory
*
* @return void
*/
public function doActionCleanAggregationCache()
{
\Includes\Utils\FileManager::unlinkRecursive(LC_DIR_CACHE_RESOURCES);
\Less_Cache::SetCacheDir(LC_DIR_DATACACHE);
\Less_Cache::CleanCache();
\XLite\Core\TopMessage::addInfo('Aggregation cache has been cleaned');
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:CssJsPerformance.php
示例3: getPromotionMessage
/**
* Get promotion message
*
* @return string
*/
protected function getPromotionMessage()
{
$addons = $this->getAddons();
$modules = array();
$params = array('clearCnd' => 1);
foreach ($addons as $addon => $title) {
if (!\Includes\Utils\Operator::checkIfClassExists('\\XLite\\Module\\' . $addon . '\\Main')) {
$match = explode('\\', $addon);
$mainClassFile = LC_DIR_MODULES . str_replace('\\', '/', $addon) . '/Main.php';
if (\Includes\Utils\FileManager::isExists($mainClassFile)) {
// Module is installed but not enabled
$limit = \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage();
$pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($match[0], $match[1], $limit);
$pageParam = 'page';
$target = 'addons_list_installed';
} else {
// Module is not installed
list(, $limit) = $this->getWidget(array(), '\\XLite\\View\\Pager\\Admin\\Module\\Install')->getLimitCondition()->limit;
$pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getMarketplacePageId($match[0], $match[1], $limit);
$pageParam = 'pageId';
$target = 'addons_list_marketplace';
}
if (0 < $pageId) {
$params[$pageParam] = $pageId;
}
$url = $this->buildURL($target, '', $params) . '#' . $match[1];
$modules[] = '<a href="' . $url . '">' . $title . '</a>';
}
}
return 0 < count($modules) ? static::t('Install additional modules to add more product sources', array('list' => implode(', ', $modules))) : '';
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:36,代码来源:Admin.php
示例4: 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 = LC_DIR_CACHE_CLASSES . $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);
}
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:Main.php
示例5: 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;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:Main.php
示例6: doActionDelete
/**
* doActionDelete
*
* @return void
* @throws
*/
protected function doActionDelete()
{
if (\Includes\Utils\FileManager::isExists($this->sqldumpFile) && !\Includes\Utils\FileManager::deleteFile($this->sqldumpFile)) {
\XLite\Core\TopMessage::addError(static::t('Unable to delete file') . ' ' . $this->sqldumpFile);
} else {
\XLite\Core\TopMessage::addInfo('SQL file was deleted successfully');
}
$this->doRedirect();
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:DbBackup.php
示例7: testGetPublicTitle
public function testGetPublicTitle()
{
\Includes\Utils\FileManager::unlinkRecursive(LC_DIR_FILES . 'attachments');
$attach = $this->getTestAttachment();
$this->assertEquals('max_ava.png', $attach->getPublicTitle(), 'check default title');
$this->assertEquals('', $attach->getTitle(), 'check empty title');
$attach->setTitle('test');
$this->assertEquals('test', $attach->getPublicTitle(), 'check normal title');
}
开发者ID:kingsj,项目名称:core,代码行数:9,代码来源:Attachment.php
示例8: getIconURL
/**
* Return URL for module icon
*
* @return string
*/
public static function getIconURL()
{
list($author, $name) = explode('\\', \Includes\Utils\ModulesManager::getModuleNameByClassName(get_called_class()));
$path = \Includes\Utils\ModulesManager::getModuleIconFile($author, $name);
$url = '';
if (\Includes\Utils\FileManager::isFileReadable($path)) {
$url = \XLite\Core\Converter::buildURL('module', null, compact('author', 'name'), 'image.php');
}
return $url;
}
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:AModule.php
示例9: __construct
/**
* Constructor
* Creates directory for locks if needed
*/
public function __construct()
{
if (!\Includes\Utils\FileManager::isExists(rtrim(static::LOCK_DIR, LC_DS))) {
\Includes\Utils\FileManager::mkdirRecursive(rtrim(static::LOCK_DIR, LC_DS));
}
if (!\Includes\Utils\FileManager::isReadable(static::LOCK_DIR) || !\Includes\Utils\FileManager::isWriteable(static::LOCK_DIR)) {
\XLite\Logger::getInstance()->log('Cannot create lock for keys', LOG_DEBUG);
}
parent::__construct();
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:14,代码来源:FileLock.php
示例10: doActionImport
/**
* Action 'import'
*
* @return void
*/
protected function doActionImport()
{
$fileName = \XLite\Core\Session::getInstance()->language_import_file;
if (\Includes\Utils\FileManager::isExists($fileName)) {
$result = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->parseImportFile($fileName, true);
\XLite\Core\Session::getInstance()->language_import_result = $result;
} else {
\XLite\Core\Session::getInstance()->language_import_file = null;
\XLite\Core\TopMessage::addError('File not found');
}
$this->setReturnURL($this->buildURL('languages'));
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:LanguageImport.php
示例11: 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;
}
开发者ID:kingsj,项目名称:core,代码行数:19,代码来源:ADecorator.php
示例12: getPlugins
/**
* Return list of registered plugins
*
* @param string $hook Hook name OPTIONAL
*
* @return array
*/
protected static function getPlugins($hook = null)
{
if (!isset(static::$plugins)) {
// Check config file
if (\Includes\Utils\FileManager::isFileReadable(static::getConfigFile())) {
// Iterate over all sections
foreach (parse_ini_file(static::getConfigFile(), true) as $section => $plugins) {
// Set plugins order
asort($plugins, SORT_NUMERIC);
// Save plugins list
static::$plugins[$section] = array_fill_keys(array_keys($plugins), null);
}
} else {
\Includes\ErrorHandler::fireError('Unable to read config file for the Decorator plugins');
}
}
return \Includes\Utils\ArrayManager::getIndex(static::$plugins, $hook);
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:25,代码来源:PluginManager.php
示例13: 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;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:23,代码来源:TemplatesChain.php
示例14: bindRegionsToUK
function bindRegionsToUK()
{
$statesFile = __DIR__ . LC_DS . 'regionForUkStates.yaml';
if (!\Includes\Utils\FileManager::isFileReadable($statesFile)) {
return false;
}
$data = \Symfony\Component\Yaml\Yaml::parse($statesFile);
foreach ($data['states'] as $state) {
$foundByCode = \XLite\Core\Database::getRepo('XLite\\Model\\State')->findOneBy(array('code' => $state['code']));
// If we found state with code we should bind region
if ($foundByCode) {
$region = \XLite\Core\Database::getRepo('XLite\\Model\\Region')->findOneBy(array('code' => $state['region']['code']));
if ($region) {
$foundByCode->setRegion($region);
}
}
}
\XLite\Core\Database::getEM()->flush();
return true;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:20,代码来源:post_rebuild.php
示例15: executeHookHandler
/**
* Execute certain hook handler
*
* @return void
*/
public function executeHookHandler()
{
// Remove old capsular directories
if (\Includes\Decorator\Utils\CacheManager::isCapsular()) {
$currentKey = \Includes\Decorator\Utils\CacheManager::getKey();
foreach (\Includes\Decorator\Utils\CacheManager::getCacheDirs(true) as $dir) {
$list = glob(rtrim($dir, LC_DS) . '.*');
if ($list) {
foreach ($list as $subdir) {
list($main, $key) = explode('.', $subdir, 2);
if ($key && $key != $currentKey) {
\Includes\Utils\FileManager::unlinkRecursive($subdir);
}
}
}
}
}
\Includes\Decorator\Utils\CacheManager::cleanupCache();
// Load classes from "classes" (do not use cache)
\Includes\Autoloader::switchLcAutoloadDir();
\Includes\Decorator\Plugin\Doctrine\Plugin\QuickData\Main::initializeCounter();
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:27,代码来源:Main.php
示例16: processItem
/**
* Process item
*
* @param mixed $item Item
*
* @return boolean
*/
protected function processItem($item)
{
$result = false;
$path = tempnam(LC_DIR_TMP, 'migrate_file');
file_put_contents($path, $item->getBody());
if (\Includes\Utils\FileManager::isExists($path)) {
$localPath = $item->isURL() ? null : $item->getStoragePath();
$result = $item->loadFromLocalFile($path, $item->getFileName() ?: basename($item->getPath()));
if ($result && $localPath && \Includes\Utils\FileManager::isExists($localPath)) {
\Includes\Utils\FileManager::deleteFile($localPath);
}
\Includes\Utils\FileManager::deleteFile($path);
}
if (!$result) {
if (!isset($this->record['s3_error_count'])) {
$this->record['s3_error_count'] = 0;
}
$this->record['s3_error_count']++;
\XLite\Logger::getInstance()->log('Couldn\'t move image ' . $item->getPath() . ' (local file system to Amazon S3)', LOG_ERR);
}
return true;
}
开发者ID:kingsj,项目名称:core,代码行数:29,代码来源:MigrateToS3.php
示例17: getWrongPermissions
/**
* Return wrong permissions
*
* @return array
*/
protected function getWrongPermissions()
{
if (!isset($this->wrongPermissions)) {
$this->wrongPermissions = array('666' => array(), '777' => array());
foreach ($this->getUpgradeEntries() as $entry) {
foreach ($entry->getWrongPermissions() as $path) {
if (\Includes\Utils\FileManager::isDir($path)) {
$this->wrongPermissions['777'][] = $path;
} else {
$this->wrongPermissions['666'][] = $path;
}
}
}
foreach ($this->wrongPermissions as $k => $v) {
if ($v) {
$this->wrongPermissions[$k] = 'chmod ' . $k . ' ' . implode(' ', array_unique($v)) . ';';
} else {
unset($this->wrongPermissions[$k]);
}
}
}
return $this->wrongPermissions;
}
开发者ID:kewaunited,项目名称:xcart,代码行数:28,代码来源:EntriesList.php
示例18: updateCustomImages
/**
* Update custom images
*
* @return void
*/
protected function updateCustomImages()
{
$dir = \XLite\Module\XC\ThemeTweaker\Main::getThemeDir() . 'images' . LC_DS;
if ($_FILES && $_FILES['new_images'] && $_FILES['new_images']['name']) {
if (!\Includes\Utils\FileManager::isExists($dir)) {
\Includes\Utils\FileManager::mkdirRecursive($dir);
}
if (\Includes\Utils\FileManager::isDirWriteable($dir)) {
foreach ($_FILES['new_images']['name'] as $i => $data) {
\Includes\Utils\FileManager::moveUploadedFileByMultiple('new_images', $i, $dir);
}
} else {
\XLite\Core\TopMessage::addError('The directory {{dir}} does not exist or is not writable.', array('dir' => $dir));
}
}
$delete = \XLite\Core\Request::getInstance()->delete;
if ($delete && is_array($delete)) {
foreach ($delete as $file => $del) {
if ($del) {
\Includes\Utils\FileManager::deleteFile($dir . $file);
}
}
}
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:29,代码来源:Images.php
示例19: setModelProperties
/**
* Populate model object properties by the passed data
*
* @param array $data Data to set
*
* @return void
*/
protected function setModelProperties(array $data)
{
$options = $this->getOptions();
$dir = LC_DIR_SKINS . \XLite\Core\Layout::PATH_COMMON . LC_DS;
if ('CDev\\SimpleCMS' == $options[0]->category) {
if ($_FILES && $_FILES['logo'] && $_FILES['logo']['name']) {
$path = \Includes\Utils\FileManager::moveUploadedFile('logo', $dir);
if ($path) {
if ($options[0]->value) {
\Includes\Utils\FileManager::deleteFile($dir . $options[0]->value);
}
$data['logo'] = basename($path);
}
} elseif (\XLite\Core\Request::getInstance()->useDefaultLogo) {
$data['logo'] = '';
if ($options[0]->value) {
\Includes\Utils\FileManager::deleteFile($dir . $options[0]->value);
}
} else {
$data['logo'] = $options[0]->value;
}
}
parent::setModelProperties($data);
}
开发者ID:kingsj,项目名称:core,代码行数:31,代码来源:Settings.php
示例20: getFilePointer
/**
* Get file pointer
* This dedicates to greatest developer of all time, Maxim Shamaev. Because getFilename() is not enough for name combining.
*
* @return resource
*/
protected function getFilePointer()
{
if (!isset($this->filePointer)) {
$name = $this->getFilename();
$dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->generator->getOptions()->dir);
if (is_writable($dir)) {
if (!\Includes\Utils\FileManager::isExists($dir . LC_DS . '.htaccess')) {
// Try to create .htaccess file to protect directory
$out = <<<OUT
Options -Indexes
Deny from all
OUT;
\Includes\Utils\FileManager::write($dir . LC_DS . '.htaccess', $out);
}
$this->filePath = $dir . LC_DS . $name;
$this->filePointer = @fopen($dir . LC_DS . $name, 'ab');
} else {
$this->generator->addError(static::t('Directory does not have permissions to write'), static::t('Directory X does not have permissions to write. Please set necessary permissions to directory X.', array('path' => $dir)));
}
}
return $this->filePointer;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:30,代码来源:Categories.php
注:本文中的Includes\Utils\FileManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论