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


PHP dmOs::getFileExtension方法代码示例

本文整理汇总了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']);
}
开发者ID:jaimesuez,项目名称:diem,代码行数:27,代码来源:DmMediaHelper.php

示例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));
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:14,代码来源:actions.class.php

示例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;
 }
开发者ID:theolymp,项目名称:diem,代码行数:19,代码来源:dmAdminCodeEditor.php

示例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);
 }
开发者ID:theolymp,项目名称:diem,代码行数:19,代码来源:actions.class.php

示例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;
 }
开发者ID:theolymp,项目名称:diem,代码行数:14,代码来源:PluginDmMedia.class.php


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