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


PHP dmOs::sanitizeFileName方法代码示例

本文整理汇总了PHP中dmOs::sanitizeFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP dmOs::sanitizeFileName方法的具体用法?PHP dmOs::sanitizeFileName怎么用?PHP dmOs::sanitizeFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dmOs的用法示例。


在下文中一共展示了dmOs::sanitizeFileName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createMediaFromUploadedFile

 protected function createMediaFromUploadedFile(array &$values)
 {
     $file = $values['file'];
     $folder = dmDb::table('DmMediaFolder')->findOneByRelPathOrCreate('widget');
     $media = dmDb::table('DmMedia')->findOneByFileAndDmMediaFolderId(dmOs::sanitizeFileName($file->getOriginalName()), $folder->id);
     if (!$media) {
         $media = dmDb::create('DmMedia', array('dm_media_folder_id' => $folder->id))->create($file)->saveGet();
     }
     $values['mediaId'] = $media->id;
 }
开发者ID:theolymp,项目名称:diem,代码行数:10,代码来源:dmWidgetContentBaseMediaForm.php

示例2: execute

 public function execute(Doctrine_Connection $connection, $arguments = array(), $options = array())
 {
     $adapter = $this->getAdapter($connection);
     $infos = $adapter->getInfos();
     $infos['tag'] = dmString::underscore(dmOs::sanitizeFileName($options['tag']));
     $file = $this->getFile($infos);
     $this->log(sprintf('About to backup %s@%s to %s', $infos['name'], $infos['host'], $file));
     $this->createDir();
     $adapter->execute($file);
     $this->log('Done.');
 }
开发者ID:jwegner,项目名称:dmSqlBackupPlugin,代码行数:11,代码来源:dmSqlBackup.php

示例3: clearName

 public function clearName($validator, $values)
 {
     if (!empty($values['file'])) {
         $filename = dmOs::sanitizeFileName($values['file']->getOriginalName());
         if (empty($filename)) {
             $error = new sfValidatorError($validator, 'This is a bad name');
             // throw an error bound to the password field
             throw new sfValidatorErrorSchema($validator, array('file' => $error));
         }
     }
     return $values;
 }
开发者ID:jdart,项目名称:diem,代码行数:12,代码来源:PluginDmMediaForm.class.php

示例4: isValidFilenameAndExtension

 /**
  * Used by ->clearnName() to validate filename.
  * @param string $filename
  */
 public function isValidFilenameAndExtension($filename)
 {
     $filenameAndExt = explode('.', dmOs::sanitizeFileName($filename));
     if (count($filenameAndExt) < 2) {
         return false;
     }
     return true;
 }
开发者ID:theolymp,项目名称:diem,代码行数:12,代码来源:PluginDmMediaForm.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(dmOs::sanitizeFileName($file->getOriginalName()));
     $this->clearCache();
     $file->save($this->getFullPath());
     $this->refreshFromFile();
     return $this;
 }
开发者ID:rafaelgou,项目名称:diem,代码行数:14,代码来源:PluginDmMedia.class.php

示例6: sanitizeFile

 /**
  * Sanitize files name (moves file if non regular name)
  */
 protected function sanitizeFile($file)
 {
     if (basename($file) != dmOs::sanitizeFileName(basename($file))) {
         $renamedFile = dmOs::join(dirname($file), dmOs::sanitizeFileName(basename($file)));
         while (file_exists($renamedFile)) {
             $renamedFile = dmOs::randomizeFileName($renamedFile);
         }
         rename($file, $renamedFile);
         $file = $renamedFile;
     }
     return $file;
 }
开发者ID:theolymp,项目名称:diem,代码行数:15,代码来源:dmMediaSynchronizer.php


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