本文整理汇总了PHP中dmOs::getFileExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP dmOs::getFileExtension方法的具体用法?PHP dmOs::getFileExtension怎么用?PHP dmOs::getFileExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dmOs
的用法示例。
在下文中一共展示了dmOs::getFileExtension方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: media_file_image_tag
function media_file_image_tag(DmMedia $file, $options = array()) {
$options = array_merge(array(
'width' => $file->isImage() ? 128 : 64,
'height' => $file->isImage() ? 98 : 64
), dmString::toArray($options, true));
if ($file->isImage()) {
$image = _media($file);
} else {
if (file_exists(
dmOs::join(
sfConfig::get('sf_web_dir')
.
'/dmCorePlugin/images/media/'
.
dmOs::getFileExtension($file->getFile(), false)
. '.png'
)
)) {
$image = _media('/dmCorePlugin/images/media/' . dmOs::getFileExtension($file->getFile(), false) . '.png');
} else {
$image = _media('/dmCorePlugin/images/media/unknown.png');
}
}
return $image->size($options['width'], $options['height']);
}
示例2: executeDownload
public function executeDownload(dmWebRequest $request)
{
$this->forward404Unless($versionNumber = $request->getParameter('v'));
$this->forward404Unless($version = dmDb::table('Version')->findOneByNumber($versionNumber));
$this->forward404Unless($package = $version->Package);
$this->forward404Unless($package->exists());
$fileName = sprintf('diem-%s%s', $version->number, dmOs::getFileExtension($package->fullPath));
$this->getService('event_log')->setOption('enabled', false);
$version->mapValue('disable_versioning', true);
$version->downloads = $version->downloads + 1;
$version->save();
$this->context->getEventDispatcher()->notify(new sfEvent($this, 'download.package', array('version' => $version->number)));
return $this->download($package->fullPath, array('file_name' => $fileName));
}
示例3: openDir
public function openDir($dir)
{
$dir = $this->decodePath($dir);
$this->validateOpenDir($dir);
$content = array();
$children = sfFinder::type('dir')->maxdepth(0)->not_name("/^\\..*/")->follow_link()->in($dir);
natcasesort($children);
foreach ($children as $child) {
$isReadable = is_readable($child);
$isWritable = is_writable($child);
$content[] = array('attributes' => array('id' => $this->encodePath($child), 'class' => sprintf('dir %s %s', $isReadable ? 'readable_dir' : 'not_readable_dir', $isWritable ? 'writable_dir' : 'not_writable_dir'), 'rel' => 'folder'), 'state' => $isReadable ? 'closed' : '', 'data' => basename($child));
}
$files = sfFinder::type('file')->maxdepth(0)->not_name("/^\\..*/")->follow_link()->in($dir);
natcasesort($files);
foreach ($files as $file) {
$content[] = array('attributes' => array('id' => $this->encodePath($file), 'class' => sprintf('file file_%s%s%s', strtolower(dmOs::getFileExtension($file, false)), is_readable($file) ? ' readable_file' : '', is_writable($file) ? ' writable_file' : ''), 'rel' => 'file'), 'data' => basename($file));
}
return $content;
}
示例4: executeSave
public function executeSave(dmWebRequest $request)
{
$file = dmProject::rootify($request->getParameter('file'));
$this->forward404Unless(file_exists($file), $file . ' does not exists');
try {
@$this->getService('file_backup')->save($file);
} catch (dmException $e) {
return $this->renderJson(array('type' => 'error', 'message' => 'backup failed : ' . $e->getMessage()));
}
@file_put_contents($file, $request->getParameter('code'));
if (dmOs::getFileExtension($file, false) == 'css') {
$return = array('type' => 'css', 'path' => $this->getHelper()->getStylesheetWebPath(dmOs::getFileWithoutExtension($file)));
} else {
$this->getService('cache_cleaner')->clearTemplate();
$return = array('type' => 'php', 'widgets' => $this->getWidgetInnersForFile($file));
}
$return['message'] = $this->getI18n()->__('Your modifications have been saved');
return $this->renderJson($return);
}
示例5: create
/**
* Physically creates asset
*
* @param string $asset_path path to the asset original file
* @param bool $move do move or just copy ?
*/
public function create(sfValidatedFile $file)
{
$this->file = $this->getAvailableFileName(dmString::slugify(dmOs::getFileWithoutExtension($file->getOriginalName())) . dmOs::getFileExtension($file->getOriginalName(), true));
$this->clearCache();
$file->save($this->getFullPath());
$this->refreshFromFile();
return $this;
}