當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。