本文整理汇总了PHP中Pagekit\Application::file方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::file方法的具体用法?PHP Application::file怎么用?PHP Application::file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagekit\Application
的用法示例。
在下文中一共展示了Application::file方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPath
/**
* @param string $path
* @return string
*/
protected function getPath($path = '')
{
$root = strtr(App::path(), '\\', '/');
$path = $this->normalizePath($root . '/storage/' . $path);
if (!is_dir($path)) {
App::file()->makeDir($path);
}
return $path;
}
示例2: getSource
/**
* {@inheritdoc}
*/
public function getSource()
{
if (!($path = $this->getPath())) {
return parent::getSource();
}
$path = App::file()->getUrl($path);
if ($version = $this->getOption('version')) {
$path .= (false === strpos($path, '?') ? '?' : '&') . 'v=' . $version;
}
return $path;
}
示例3: uninstall
/**
* @param array $uninstall
* @return bool
*/
public function uninstall($uninstall)
{
foreach ((array) $uninstall as $name) {
if (!($package = App::package($name))) {
throw new \RuntimeException(__('Unable to find "%name%".', ['%name%' => $name]));
}
$this->disable($package);
$this->getScripts($package)->uninstall();
App::config('system')->remove('packages.' . $package->get('module'));
if ($this->composer->isInstalled($package->getName())) {
$this->composer->uninstall($package->getName());
} else {
if (!($path = $package->get('path'))) {
throw new \RuntimeException(__('Package path is missing.'));
}
$this->output->writeln(__("Removing package folder."));
App::file()->delete($path);
@rmdir(dirname($path));
}
}
}
示例4: getCachepath
/**
* @return bool|string
*/
public function getCachepath()
{
$folder = App::path() . '/' . App::module('bixie/portfolio')->config('cache_path');
if (file_exists($folder) && is_writable($folder)) {
//all fine, quick return
return $folder;
}
//try to create user-folder
App::file()->makeDir($folder, 0755);
if (!file_exists($folder)) {
//create default folder
$folder = $this->app['path.cache'] . '/portfolio';
if (!file_exists($folder)) {
App::file()->makeDir($folder, 0755);
}
}
if (!file_exists($folder) || !is_writable($folder)) {
//give up
return false;
}
return $folder;
}
示例5: removeFilesAction
/**
* @Request({"names": "array"})
*/
public function removeFilesAction($names)
{
foreach ($names as $name) {
if (!($path = $this->getPath($name))) {
return $this->error(__('Invalid path.'));
}
if ('w' !== $this->getMode($path)) {
throw new ForbiddenException(__('Permission denied.'));
}
try {
App::file()->delete($path);
} catch (\Exception $e) {
return $this->error(__('Unable to remove.'));
}
}
return $this->success(__('Removed selected.'));
}
示例6: getImageCachepath
/**
* @return bool|string
*/
public function getImageCachepath()
{
if ($folder = App::locator()->get(App::module('bixie/framework')->config('image_cache_path')) and is_writable($folder)) {
//all fine, quick return
return $folder;
}
//try to create user-folder
App::file()->makeDir($folder, 0755);
if (!file_exists($folder)) {
//create default folder
$folder = $this->app['path.storage'] . '/bixframework';
if (!file_exists($folder)) {
App::file()->makeDir($folder, 0755);
}
}
if (!file_exists($folder) || !is_writable($folder)) {
//give up
return false;
}
return $folder;
}
示例7: clearCache
/**
* @param array $options
*/
public static function clearCache($options = [])
{
if (@$options['temp'] and $cache_path = App::module('bixie/portfolio')->getCachepath()) {
App::file()->delete($cache_path);
}
}
示例8: clearCache
/**
* @param array $options
*/
public static function clearCache($options = [])
{
if (@$options['temp'] and $cache_path = App::module('bixie/framework')->getImageCachepath()) {
App::file()->delete($cache_path);
}
}
示例9: clearCache
/**
* @param array $options
*/
public static function clearCache($options = [])
{
if (@$options['temp']) {
App::file()->delete(App::get('path.cache') . '/portfolio');
}
}
示例10: doClearCache
/**
* TODO: clear opcache
*/
public function doClearCache(array $options = [])
{
// clear cache
if (empty($options) || @$options['cache']) {
App::cache()->flushAll();
foreach (glob(App::get('path.cache') . '/*.cache') as $file) {
@unlink($file);
}
}
// clear temp folder
if (@$options['temp']) {
foreach (App::finder()->in(App::get('path.temp'))->depth(0)->ignoreDotFiles(true) as $file) {
App::file()->delete($file->getPathname());
}
}
}
示例11: getSource
/**
* {@inheritdoc}
*/
public function getSource()
{
return ($path = $this->getPath()) ? App::file()->getUrl($path) : parent::getSource();
}