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


PHP File::getName方法代码示例

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


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

示例1: indexCrawledDocuments

 /**
  * Indexes document that was set in __construct.
  */
 public function indexCrawledDocuments()
 {
     $sFileName = $this->oFile->getName();
     $oFileMinorDocType = $this->oDbr->selectRow('image', 'img_minor_mime', array('img_name' => $sFileName, 'img_major_mime' => 'application'));
     if ($oFileMinorDocType === false) {
         return;
     }
     $sFileDocType = $this->mimeDecoding($oFileMinorDocType->img_minor_mime, $sFileName);
     if (!$this->checkDocType($sFileDocType, $sFileName)) {
         return;
     }
     $sFileTimestamp = $this->oFile->getTimestamp();
     $sVirtualFilePath = $this->oFile->getPath();
     $oFileRepoLocalRef = $this->oFile->getRepo()->getLocalReference($sVirtualFilePath);
     if (!is_null($oFileRepoLocalRef)) {
         $sFilePath = $oFileRepoLocalRef->getPath();
     }
     if ($this->checkExistence($sVirtualFilePath, 'repo', $sFileTimestamp, $sFileName)) {
         return;
     }
     $sFileText = $this->getFileText($sFilePath, $sFileName);
     $doc = $this->makeRepoDocument($sFileDocType, $sFileName, $sFileText, $sFilePath, $sFileTimestamp, $sVirtualFilePath);
     if ($doc) {
         // mode and ERROR_MSG_KEY are only passed for the case when addDocument fails
         $this->oMainControl->addDocument($doc, $this->mode, self::S_ERROR_MSG_KEY);
     }
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:30,代码来源:BuildIndexMwSingleFile.class.php

示例2: executeImage

 public function executeImage(sfWebRequest $request)
 {
     $member = $this->getRoute()->getMember();
     if (!$member) {
         return sfView::NONE;
     }
     $message = $request->getMailMessage();
     $images = $message->getImages();
     foreach ($images as $image) {
         $count = $member->getMemberImage()->count();
         if ($count >= 3) {
             return sfView::ERROR;
         }
         $validator = new opValidatorImageFile();
         $validFile = $validator->clean($image);
         $file = new File();
         $file->setFromValidatedFile($validFile);
         $file->setName('m_' . $member->getId() . '_' . $file->getName());
         $memberImage = new MemberImage();
         $memberImage->setMember($member);
         $memberImage->setFile($file);
         if (!$count) {
             $memberImage->setIsPrimary(true);
         }
         $memberImage->save();
     }
     return sfView::NONE;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:28,代码来源:actions.class.php

示例3: executeImage

 public function executeImage(sfWebRequest $request)
 {
     $member = $this->getRoute()->getMember();
     if (!$member) {
         return sfView::NONE;
     }
     $community = Doctrine::getTable('Community')->find($request->getParameter('id'));
     if (!$community) {
         return sfView::ERROR;
     }
     $isAdmin = Doctrine::getTable('CommunityMember')->isAdmin($member->getId(), $community->getId());
     if (!$isAdmin || $community->getImageFileName()) {
         return sfView::ERROR;
     }
     $message = $request->getMailMessage();
     if ($images = $message->getImages()) {
         $image = array_shift($images);
         $validator = new opValidatorImageFile();
         $validFile = $validator->clean($image);
         $file = new File();
         $file->setFromValidatedFile($validFile);
         $file->setName('c_' . $community->getId() . '_' . $file->getName());
         $community->setFile($file);
         $community->save();
     }
     return sfView::NONE;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:27,代码来源:actions.class.php

示例4: getName

 /**
  * Get the name of the file
  *
  * If there is no processed file in the file system (as the original file did not have to be modified e.g.
  * when the original image is in the boundaries of the maxW/maxH stuff)
  * then just return the name of the original file
  *
  * @return string
  */
 public function getName()
 {
     if ($this->usesOriginalFile()) {
         return $this->originalFile->getName();
     } else {
         return $this->name;
     }
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:17,代码来源:ProcessedFile.php

示例5: test

 /**
  * Runs the test.
  */
 public function test()
 {
     $path = DIR_FILES . '/mail/logo.gif';
     $name = 'logo.gif';
     $mimeType = 'image/gif';
     $attachment = new File($path, $name, $mimeType);
     $this->assertEquals(file_get_contents($path), $attachment->getContent());
     $this->assertEquals($name, $attachment->getName());
     $this->assertEquals($mimeType, $attachment->getMimeType());
     $this->assertEquals(\Jyxo\Mail\Email\Attachment::DISPOSITION_ATTACHMENT, $attachment->getDisposition());
     $this->assertFalse($attachment->isInline());
     $this->assertEquals('', $attachment->getCid());
     $this->assertEquals('', $attachment->getEncoding());
 }
开发者ID:JerryCR,项目名称:php-2,代码行数:17,代码来源:FileTest.php

示例6: save

 public function save()
 {
     $file = new File();
     $file->setFromValidatedFile($this->getValue('file'));
     $file->setName('b_' . $file->getName());
     if ($this->isNew()) {
         $bannerImage = new BannerImage();
     } else {
         $bannerImage = $this->getObject();
     }
     $bannerImage->setFile($file);
     $bannerImage->setUrl($this->getValue('url'));
     $bannerImage->setName($this->getValue('name'));
     return $bannerImage->save();
 }
开发者ID:phenom,项目名称:OpenPNE3,代码行数:15,代码来源:BannerImageForm.class.php

示例7: control

 public function control()
 {
     $this->redirectToSternIndiaEndPoint();
     $config = Config::getInstance();
     if (isset($_POST['upload']) && $_POST['upload'] == 'Upload') {
         $target_dir = new FileSystem('upload/');
         $file = new File('foo', $target_dir);
         $name = date('D_d_m_Y_H_m_s_');
         $name = $name . $file->getName();
         $file->setName($name);
         $config = Config::getInstance();
         $file->addValidations(array(new Mimetype($config->getMimeTypes()), new Size('5M')));
         $data = array('name' => $file->getNameWithExtension(), 'extension' => $file->getExtension(), 'mime' => $file->getMimetype(), 'size' => $file->getSize(), 'md5' => $file->getMd5());
         try {
             // /Profiler::debugPoint(true,__METHOD__, __FILE__, __LINE__,$data);
             $file->upload();
             //Profiler::debugPoint(true,__METHOD__, __FILE__, __LINE__,$data);
         } catch (Exception $e) {
             $errors = $file->getErrors();
         }
         $csvReader = new CSVReader();
         $destinationFile = $target_dir->directory . $file->getNameWithExtension();
         $data = $csvReader->parse_file($destinationFile);
         //$country= DAOFactory::getDAO('LocationDAO');
         foreach ($data as $loc_arr) {
             Utils::processLocation($loc_arr);
         }
         //Profiler::debugPoint(true,__METHOD__, __FILE__, __LINE__);
         $target_dir = "uploads/";
         $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
         $uploadOk = 1;
         $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
         // Check if image file is a actual image or fake image
         if (isset($_POST["submit"])) {
             $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
             if ($check !== false) {
                 echo "File is an image - " . $check["mime"] . ".";
                 $uploadOk = 1;
             } else {
                 echo "File is not an image.";
                 $uploadOk = 0;
             }
         }
     }
     return $this->generateView();
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:46,代码来源:class.FileUploadController.php

示例8: doPurge

 /**
  * Override handling of action=purge
  */
 public function doPurge()
 {
     $this->loadFile();
     if ($this->mFile->exists()) {
         wfDebug('ImagePage::doPurge purging ' . $this->mFile->getName() . "\n");
         $update = new HTMLCacheUpdate($this->mTitle, 'imagelinks');
         $update->doUpdate();
         $this->mFile->upgradeRow();
         $this->mFile->purgeCache(array('forThumbRefresh' => true));
     } else {
         wfDebug('ImagePage::doPurge no image for ' . $this->mFile->getName() . "; limiting purge to cache only\n");
         // even if the file supposedly doesn't exist, force any cached information
         // to be updated (in case the cached information is wrong)
         $this->mFile->purgeCache(array('forThumbRefresh' => true));
     }
     return parent::doPurge();
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:20,代码来源:WikiFilePage.php

示例9: save

 public function save()
 {
     $count = $this->member->getMemberImage()->count();
     if ($count >= 3) {
         throw new opRuntimeException('Cannot add an image any more.');
     }
     $file = new File();
     $file->setFromValidatedFile($this->getValue('file'));
     $file->setName('m_' . $this->member->getId() . '_' . $file->getName());
     $memberImage = new MemberImage();
     $memberImage->setMember($this->member);
     $memberImage->setFile($file);
     if (!$count) {
         $memberImage->setIsPrimary(true);
     }
     return $memberImage->save();
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:17,代码来源:MemberImageForm.class.php

示例10: save

 public function save()
 {
     if ($this->getValue('file')) {
         if ($this->community->getFile()) {
             $this->community->getFile()->delete();
         }
         $file = new File();
         $file->setFromValidatedFile($this->getValue('file'));
         $file->setName('c_' . $this->community->getId() . '_' . $file->getName());
         $this->community->setFile($file);
     } elseif ($this->getValue('file_delete')) {
         $this->community->getFile()->delete();
         $this->community->setFile(null);
     } else {
         return;
     }
     $this->community->save();
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:18,代码来源:CommunityFileForm.class.php

示例11: doTransform

	/**
	 * Performs a transform with VIPS
	 *
	 * @see VipsScaler::onTransform
	 *
	 * @param BitmapHandler $handler
	 * @param File $file
	 * @param array $params
	 * @param array $options
	 * @param MediaTransformOutput &$mto
	 * @return bool
	 */
	public static function doTransform( $handler, $file, $params, $options, &$mto ) {
		wfDebug( __METHOD__ . ': scaling ' . $file->getName() . " using vips\n" );

		$vipsCommands = self::makeCommands( $handler, $file, $params, $options );
		if ( count( $vipsCommands ) == 0 ) {
			return true;
		}

		# Execute the commands
		foreach ( $vipsCommands as $i => $command ) {
			# Set input/output files
			if ( $i == 0 && count( $vipsCommands ) == 1 ) {
				# Single command, so output directly to dstPath
				$command->setIO( $params['srcPath'], $params['dstPath'] );
			} elseif ( $i == 0 ) {
				# First command, input from srcPath, output to temp
				$command->setIO( $params['srcPath'], 'v', VipsCommand::TEMP_OUTPUT );
			} elseif ( $i + 1 == count( $vipsCommands ) ) {
				# Last command, output to dstPath
				$command->setIO( $vipsCommands[$i - 1], $params['dstPath'] );
			} else {
				$command->setIO( $vipsCommands[$i - 1], 'v', VipsCommand::TEMP_OUTPUT );
			}

			$retval = $command->execute();
			if ( $retval != 0 ) {
				wfDebug( __METHOD__ . ": vips command failed!\n" );
				$mto = $handler->getMediaTransformError( $params, $command->getErrorString() );
				return false;
			}
		}

		# Set comment
		if ( !empty( $options['setcomment'] ) && !empty( $params['comment'] ) ) {
			self::setJpegComment( $params['dstPath'], $params['comment'] );
		}

		# Set the output variable
		$mto = new ThumbnailImage( $file, $params['dstUrl'],
			$params['clientWidth'], $params['clientHeight'], $params['dstPath'] );

		# Stop processing
		return false;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:56,代码来源:VipsScaler_body.php

示例12: updateObject

 public function updateObject($values = null)
 {
     if (is_null($values)) {
         $values = $this->getValues();
     }
     $image = null;
     if (array_key_exists('image', $values)) {
         $image = $values['image'];
         unset($values['image']);
     }
     $obj = parent::updateObject($values);
     if ($image instanceof sfValidatedFile) {
         unset($obj->Image);
         $file = new File();
         $file->setFromValidatedFile($image);
         $file->setName('oauth_' . $obj->getId() . '_' . $file->getName());
         $obj->setImage($file);
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:19,代码来源:OAuthConsumerInformationForm.class.php

示例13: doPurge

 /**
  * Override handling of action=purge
  * @return bool
  */
 public function doPurge()
 {
     $this->loadFile();
     if ($this->mFile->exists()) {
         wfDebug('ImagePage::doPurge purging ' . $this->mFile->getName() . "\n");
         DeferredUpdates::addUpdate(new HTMLCacheUpdate($this->mTitle, 'imagelinks'));
         $this->mFile->purgeCache(['forThumbRefresh' => true]);
     } else {
         wfDebug('ImagePage::doPurge no image for ' . $this->mFile->getName() . "; limiting purge to cache only\n");
         // even if the file supposedly doesn't exist, force any cached information
         // to be updated (in case the cached information is wrong)
         $this->mFile->purgeCache(['forThumbRefresh' => true]);
     }
     if ($this->mRepo) {
         // Purge redirect cache
         $this->mRepo->invalidateImageRedirect($this->mTitle);
     }
     return parent::doPurge();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:23,代码来源:WikiFilePage.php

示例14: doPurge

 /**
  * Override handling of action=purge
  */
 public function doPurge()
 {
     global $wgCityId;
     $this->loadFile();
     if ($this->mFile->exists()) {
         wfDebug('ImagePage::doPurge purging ' . $this->mFile->getName() . "\n");
         // Wikia Change Start @author Scott Rabin (srabin@wikia-inc.com)
         $task = (new \Wikia\Tasks\Tasks\HTMLCacheUpdateTask())->wikiId($wgCityId)->title($this->mTitle);
         $task->call('purge', 'imagelinks');
         $task->queue();
         // Wikia Change End
         $this->mFile->upgradeRow();
         $this->mFile->purgeCache(array('forThumbRefresh' => true));
     } else {
         wfDebug('ImagePage::doPurge no image for ' . $this->mFile->getName() . "; limiting purge to cache only\n");
         // even if the file supposedly doesn't exist, force any cached information
         // to be updated (in case the cached information is wrong)
         $this->mFile->purgeCache(array('forThumbRefresh' => true));
     }
     return parent::doPurge();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:WikiFilePage.php

示例15: array

 function get_gallery()
 {
     $gallery_name = Params::get("gallery_name");
     $result = array();
     $result["gallery_name"] = $gallery_name;
     $d = new Dir(self::GALLERY_ROOT_PATH . $gallery_name);
     $files = $d->listFiles();
     $image_list = array();
     foreach ($files as $f) {
         if ($f->isFile() && $f->getExtension() != ".ini") {
             $image = array();
             $image["path"] = $f->getPath();
             $image["title"] = str_replace("_", " ", $f->getName());
             $image_list[$f->getFilename()] = $image;
         }
     }
     $gallery_dir = new Dir(self::GALLERY_ROOT_PATH . $gallery_name . DS);
     $found_files = $gallery_dir->findFilesEndingWith("gallery.ini");
     if (count($found_files) > 0) {
         $gallery_ini_file = $found_files[0];
         $gallery_props = PropertiesUtils::readFromFile($gallery_ini_file, true);
         $enhanced_image_list = array();
         foreach ($section as $s) {
             $path = $s["path"];
             if (strpos($path, "DS") === 0) {
                 $new_image["path"] = $path;
             } else {
                 $new_image["path"] = self::GALLERY_ROOT_PATH . $gallery_name . $s["path"];
             }
             $f = new File($new_image["path"]);
             $new_image["title"] = isset($s["title"]) ? $s["title"] : str_replace("_", " ", $f->getName());
             $new_image["description"] = isset($s["description"]) ? $s["description"] : null;
             $enhanced_image_list[] = $new_image;
         }
         $result["image_list"] = $enhanced_image_list;
     } else {
         $result["image_list"] = $image_list;
     }
     return $result;
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:40,代码来源:GalleryController.class.php


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