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


PHP FileUtil::isURL方法代码示例

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


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

示例1: validate

 /**
  * @see	\wcf\form\IForm::validate()
  */
 public function validate()
 {
     parent::validate();
     // check if file is uploaded or linked
     if (!empty($this->file['tmp_name'])) {
         $this->backup = $this->file['tmp_name'];
     } else {
         if ($this->fileLink != '') {
             //check if file is external url
             if (FileUtil::isURL($this->fileLink)) {
                 try {
                     //download file
                     $this->backup = FileUtil::downloadFileFromHttp($this->fileLink, 'cms_backup');
                 } catch (SystemException $e) {
                     //download failed
                     throw new UserInputException('fileLink', 'downloadFailed');
                 }
             } else {
                 //file not found
                 if (!file_exists($this->fileLink)) {
                     throw new UserInputException('fileLink', 'notFound');
                 } else {
                     $this->backup = $this->fileLink;
                 }
             }
         } else {
             throw new UserInputException('file', 'empty');
         }
     }
 }
开发者ID:knzo,项目名称:Fireball,代码行数:33,代码来源:CMSImportForm.class.php

示例2: validate

 /**
  * @see	\cms\system\content\type\IContentType::validate()
  */
 public function validate($data)
 {
     if (!isset($data['video'])) {
         throw new UserInputException('data[video]');
     }
     if (!FileUtil::isURL($data['video'])) {
         throw new UserInputException('data[video]', 'notValid');
     }
 }
开发者ID:knzo,项目名称:Fireball,代码行数:12,代码来源:YoutubeContentType.class.php

示例3: __construct

 /**
  * Creates a new ActiveStyle object.
  * 
  * @param	Style	$object
  */
 public function __construct(Style $object)
 {
     parent::__construct($object);
     // calculate page logo path
     if (!empty($this->object->data['variables']['page.logo.image']) && !FileUtil::isURL($this->object->data['variables']['page.logo.image']) && StringUtil::substring($this->object->data['variables']['page.logo.image'], 0, 1) !== '/') {
         $this->object->data['variables']['page.logo.image'] = RELATIVE_WCF_DIR . $this->object->data['variables']['page.logo.image'];
     }
     // load icon cache
     $cacheName = 'icon-' . PACKAGE_ID . '-' . $this->styleID;
     CacheHandler::getInstance()->addResource($cacheName, WCF_DIR . 'cache/cache.' . $cacheName . '.php', 'wcf\\system\\cache\\builder\\IconCacheBuilder');
     $this->iconCache = CacheHandler::getInstance()->get($cacheName);
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:17,代码来源:ActiveStyle.class.php

示例4: getArchive

	/**
	 * Returns current package archive.
	 * 
	 * @return	wcf\system\package\PackageArchive
	 */
	public function getArchive() {
		if ($this->archive === null) {
			$this->archive = new PackageArchive($this->queue->archive, $this->getPackage());
			
			if (FileUtil::isURL($this->archive->getArchive())) {
				// get return value and update entry in
				// package_installation_queue with this value
				$archive = $this->archive->downloadArchive();
				$queueEditor = new PackageInstallationQueueEditor($this->queue);
				$queueEditor->update(array(
					'archive' => $archive
				));
			}
			
			$this->archive->openArchive();
		}
		
		return $this->archive;
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:24,代码来源:PackageInstallationDispatcher.class.php

示例5: install

 /**
  * Installs the specified package.
  * 
  * @param	string	$file
  */
 private function install($file)
 {
     // PackageStartInstallForm::validateDownloadPackage()
     if (FileUtil::isURL($file)) {
         // download package
         $archive = new PackageArchive($file, null);
         try {
             if (VERBOSITY >= 1) {
                 Log::info("Downloading '" . $file . "'");
             }
             $file = $archive->downloadArchive();
         } catch (SystemException $e) {
             $this->error('notFound', array('file' => $file));
         }
     } else {
         // probably local path
         if (!file_exists($file)) {
             $this->error('notFound', array('file' => $file));
         }
         $archive = new PackageArchive($file, null);
     }
     // PackageStartInstallForm::validateArchive()
     // try to open the archive
     try {
         // TODO: Exceptions thrown within openArchive() are discarded, resulting in
         // the meaningless message 'not a valid package'
         $archive->openArchive();
     } catch (SystemException $e) {
         $this->error('noValidPackage');
     }
     $errors = PackageInstallationDispatcher::validatePHPRequirements($archive->getPhpRequirements());
     if (!empty($errors)) {
         // TODO: Nice output
         $this->error('phpRequirements', array('errors' => $errors));
     }
     // try to find existing package
     $sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\tWHERE\tpackage = ?";
     $statement = CLIWCF::getDB()->prepareStatement($sql);
     $statement->execute(array($archive->getPackageInfo('name')));
     $row = $statement->fetchArray();
     $package = null;
     if ($row !== false) {
         $package = new Package(null, $row);
     }
     // check update or install support
     if ($package !== null) {
         CLIWCF::getSession()->checkPermissions(array('admin.system.package.canUpdatePackage'));
         $archive->setPackage($package);
         if (!$archive->isValidUpdate()) {
             $this->error('noValidUpdate');
         }
     } else {
         CLIWCF::getSession()->checkPermissions(array('admin.system.package.canInstallPackage'));
         if (!$archive->isValidInstall()) {
             $this->error('noValidInstall');
         } else {
             if ($archive->getPackageInfo('isApplication')) {
                 // applications cannot be installed via CLI
                 $this->error('cli.installIsApplication');
             } else {
                 if ($archive->isAlreadyInstalled()) {
                     $this->error('uniqueAlreadyInstalled');
                 } else {
                     if ($archive->getPackageInfo('isApplication') && $this->archive->hasUniqueAbbreviation()) {
                         $this->error('noUniqueAbbrevation');
                     }
                 }
             }
         }
     }
     // PackageStartInstallForm::save()
     $processNo = PackageInstallationQueue::getNewProcessNo();
     // insert queue
     $queue = PackageInstallationQueueEditor::create(array('processNo' => $processNo, 'userID' => CLIWCF::getUser()->userID, 'package' => $archive->getPackageInfo('name'), 'packageName' => $archive->getLocalizedPackageInfo('packageName'), 'packageID' => $package !== null ? $package->packageID : null, 'archive' => $file, 'action' => $package !== null ? 'update' : 'install'));
     // PackageInstallationDispatcher::openQueue()
     $parentQueueID = 0;
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID = ?", array(CLIWCF::getUser()->userID));
     $conditions->add("parentQueueID = ?", array($parentQueueID));
     if ($processNo != 0) {
         $conditions->add("processNo = ?", array($processNo));
     }
     $conditions->add("done = ?", array(0));
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_package_installation_queue\n\t\t\t" . $conditions . "\n\t\t\tORDER BY\tqueueID ASC";
     $statement = CLIWCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     $packageInstallation = $statement->fetchArray();
     if (!isset($packageInstallation['queueID'])) {
         $this->error('internalOpenQueue');
         return;
     } else {
         $queueID = $packageInstallation['queueID'];
     }
     // PackageInstallationConfirmPage::readParameters()
     $queue = new PackageInstallationQueue($queueID);
//.........这里部分代码省略.........
开发者ID:nick-strohm,项目名称:WCF,代码行数:101,代码来源:PackageCLICommand.class.php

示例6: validateDownloadPackage

	/**
	 * Validates the download package input.
	 */
	protected function validateDownloadPackage() {
		if (FileUtil::isURL($this->downloadPackage)) {
			// download package
			$this->archive = new PackageArchive($this->downloadPackage, $this->package);
			
			try {
				$this->downloadPackage = $this->archive->downloadArchive();
				//$this->archive->downloadArchive();
			}
			catch (SystemException $e) {
				throw new UserInputException('downloadPackage', 'notFound');
			}
		}
		else {
			// probably local path
			if (!file_exists($this->downloadPackage)) {
				throw new UserInputException('downloadPackage', 'notFound');
			}
			
			$this->archive = new PackageArchive($this->downloadPackage, $this->package);
		}
		
		$this->validateArchive('downloadPackage');
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:27,代码来源:PackageStartInstallForm.class.php

示例7: getBody

 /**
  * Creates the Body (Message, Attachments) for the Mail
  * Returns the created Body to the function which invoke this class
  * 
  * @return	string		mail body
  */
 public function getBody()
 {
     $counter = 1;
     $this->body = '';
     if (count($this->getAttachments())) {
         // add message
         $this->body .= '--' . $this->getBoundary() . self::$crlf;
         $this->body .= 'Content-Type: ' . $this->getContentType() . '; charset="UTF-8"' . self::$crlf;
         $this->body .= 'Content-Transfer-Encoding: 8bit' . self::$crlf;
         //$this->body 	.= self::$crlf.self::$crlf;
         $this->body .= self::$crlf;
         // wrap lines after 70 characters
         $this->body .= wordwrap($this->getMessage(), 70);
         $this->body .= self::$crlf . self::$crlf;
         $this->body .= '--' . $this->getBoundary() . self::$crlf;
         // add attachments
         foreach ($this->getAttachments() as $attachment) {
             $fileName = $attachment['name'];
             $path = $attachment['path'];
             // download file
             if (FileUtil::isURL($path)) {
                 $tmpPath = FileUtil::getTemporaryFilename('mailAttachment_');
                 if (!@copy($path, $tmpPath)) {
                     continue;
                 }
                 $path = $tmpPath;
             }
             // get file contents
             $data = @file_get_contents($path);
             $data = chunk_split(base64_encode($data), 70, self::$crlf);
             $this->body .= 'Content-Type: application/octetstream; name="' . $fileName . '"' . self::$crlf;
             $this->body .= 'Content-Transfer-Encoding: base64' . self::$crlf;
             $this->body .= 'Content-Disposition: attachment; filename="' . $fileName . '"' . self::$crlf . self::$crlf;
             $this->body .= $data . self::$crlf . self::$crlf;
             if ($counter < count($this->getAttachments())) {
                 $this->body .= '--' . $this->getBoundary() . self::$crlf;
             }
             $counter++;
         }
         $this->body .= self::$crlf . '--' . $this->getBoundary() . '--';
     } else {
         //$this->body 	.= self::$crlf;
         $this->body .= $this->getMessage();
     }
     return $this->body;
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:52,代码来源:Mail.class.php

示例8: validateDownloadPackage

 /**
  * Validates the download package input.
  */
 protected function validateDownloadPackage()
 {
     $this->activeTabMenuItem = 'upload';
     if (FileUtil::isURL($this->downloadPackage)) {
         // download package
         $this->archive = new PackageArchive($this->downloadPackage, $this->package);
         try {
             $this->downloadPackage = $this->archive->downloadArchive();
         } catch (SystemException $e) {
             throw new UserInputException('downloadPackage', 'downloadFailed');
         }
     } else {
         // probably local path
         if (!file_exists($this->downloadPackage)) {
             throw new UserInputException('downloadPackage', 'downloadFailed');
         }
     }
     if (!PackageValidationManager::getInstance()->validate($this->downloadPackage, false)) {
         $exception = PackageValidationManager::getInstance()->getException();
         if ($exception instanceof PackageValidationException) {
             switch ($exception->getCode()) {
                 case PackageValidationException::INVALID_PACKAGE_NAME:
                 case PackageValidationException::MISSING_PACKAGE_XML:
                     throw new UserInputException('downloadPackage', 'noValidPackage');
                     break;
             }
         }
     }
     $this->package = PackageValidationManager::getInstance()->getPackageValidationArchive()->getPackage();
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:33,代码来源:PackageStartInstallForm.class.php

示例9: parseAdditionalStyles

 private static function parseAdditionalStyles(&$variables)
 {
     self::$variables = $variables;
     // fix images location
     if (!empty(self::$variables['global.images.location']) && !FileUtil::isURL(self::$variables['global.images.location']) && substr(self::$variables['global.images.location'], 0, 1) != '/') {
         self::$variables['global.images.location'] = '../' . self::$variables['global.images.location'];
     }
     // fix images location
     if (!empty(self::$variables['global.icons.location']) && !FileUtil::isURL(self::$variables['global.icons.location']) && substr(self::$variables['global.icons.location'], 0, 1) != '/') {
         self::$variables['global.icons.location'] = '../' . self::$variables['global.icons.location'];
     }
     // parse additional styles
     if (!empty($variables['user.additional.style.input1.use'])) {
         $variables['user.additional.style.input1.use'] = preg_replace_callback('/\\$([a-z0-9_\\-\\.]+)\\$/', array('self', 'parseAdditionalStylesCallback'), $variables['user.additional.style.input1.use']);
     }
     if (!empty($variables['user.additional.style.input2.use'])) {
         $variables['user.additional.style.input2.use'] = preg_replace_callback('/\\$([a-z0-9_\\-\\.]+)\\$/', array('self', 'parseAdditionalStylesCallback'), $variables['user.additional.style.input2.use']);
     }
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:19,代码来源:StyleEditor.class.php

示例10: getArchive

 /**
  * Returns current package archive.
  * 
  * @return	\wcf\system\package\PackageArchive
  */
 public function getArchive()
 {
     if ($this->archive === null) {
         $package = $this->getPackage();
         // check if we're doing an iterative update of the same package
         if ($this->previousPackageData !== null && $this->getPackage()->package == $this->previousPackageData['package']) {
             if (Package::compareVersion($this->getPackage()->packageVersion, $this->previousPackageData['packageVersion'], '<')) {
                 // fake package to simulate the package version required by current archive
                 $this->getPackage()->setPackageVersion($this->previousPackageData['packageVersion']);
             }
         }
         $this->archive = new PackageArchive($this->queue->archive, $this->getPackage());
         if (FileUtil::isURL($this->archive->getArchive())) {
             // get return value and update entry in
             // package_installation_queue with this value
             $archive = $this->archive->downloadArchive();
             $queueEditor = new PackageInstallationQueueEditor($this->queue);
             $queueEditor->update(array('archive' => $archive));
         }
         $this->archive->openArchive();
     }
     return $this->archive;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:28,代码来源:PackageInstallationDispatcher.class.php

示例11: unzipPackageArchive

	/**
	 * Unzips compressed package archives and returns the temporary file name.
	 * 
	 * @param	string		$archive	filename
	 * @return	string
	 */
	public static function unzipPackageArchive($archive) {
		if (!FileUtil::isURL($archive)) {
			$tar = new Tar($archive);
			$tar->close();
			if ($tar->isZipped()) {
				$tmpName = FileUtil::getTemporaryFilename('package_');
				if (FileUtil::uncompressFile($archive, $tmpName)) {
					return $tmpName;
				}
			}
		}
		
		return $archive;
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:20,代码来源:PackageArchive.class.php

示例12: exportSmilies

 /**
  * Exports smilies.
  */
 public function exportSmilies($offset, $limit)
 {
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\t" . $this->databasePrefix . "smilies\n\t\t\tORDER BY\tsmilieid";
     $statement = $this->database->prepareStatement($sql, $limit, $offset);
     $statement->execute();
     while ($row = $statement->fetchArray()) {
         // replace imagefolder
         $row['smiliepath'] = str_replace('{imagefolder}', 'images', $row['smiliepath']);
         // insert source path
         if (!FileUtil::isURL($row['smiliepath'])) {
             $row['smiliepath'] = $this->fileSystemPath . $row['smiliepath'];
         }
         ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smilieid'], array('smileyTitle' => $row['smilietitle'], 'smileyCode' => $row['smiliecode'], 'showOrder' => $row['smilieorder']), array('fileLocation' => $row['smiliepath']));
     }
 }
开发者ID:NurPech,项目名称:com.woltlab.wcf.exporter,代码行数:18,代码来源:WBB2xExporter.class.php

示例13: exportUserAvatars

 /**
  * Exports user avatars.
  */
 public function exportUserAvatars($offset, $limit)
 {
     $sql = "(\n\t\t\t\tSELECT\t\tid_member, 'attachment' AS type, filename AS avatarName, (id_attach || '_' || file_hash) AS filename\n\t\t\t\tFROM\t\t" . $this->databasePrefix . "attachments\n\t\t\t\tWHERE\t\tid_member <> ?\n\t\t\t)\n\t\t\tUNION\n\t\t\t(\n\t\t\t\tSELECT\t\tid_member, 'user' AS type, avatar AS avatarName, avatar AS filename\n\t\t\t\tFROM\t\t" . $this->databasePrefix . "members\n\t\t\t\tWHERE\t\tavatar <> ?\n\t\t\t)";
     $statement = $this->database->prepareStatement($sql, $limit, $offset);
     $statement->execute(array('', 0));
     while ($row = $statement->fetchArray()) {
         switch ($row['type']) {
             case 'attachment':
                 $fileLocation = $this->readOption('attachmentUploadDir') . '/' . $row['filename'];
                 break;
             case 'user':
                 if (FileUtil::isURL($row['filename'])) {
                     return;
                 }
                 $fileLocation = $this->readOption('avatar_directory') . '/' . $row['filename'];
                 break;
         }
         ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, array('avatarName' => basename($row['avatarName']), 'avatarExtension' => pathinfo($row['avatarName'], PATHINFO_EXTENSION), 'userID' => $row['id_member']), array('fileLocation' => $fileLocation));
     }
 }
开发者ID:NurPech,项目名称:com.woltlab.wcf.exporter,代码行数:23,代码来源:SMF2xExporter.class.php


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