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


PHP eZHTTPFile::attribute方法代码示例

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


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

示例1: initializeFromHTTPFile

 /**
  * Initializes the content object attribute with the uploaded HTTP file
  *
  * @param eZHTTPFile $httpFile
  * @param string $imageAltText Optional image ALT text
  *
  * @return TODO: FIXME
  */
 function initializeFromHTTPFile($httpFile, $imageAltText = false)
 {
     $this->increaseImageSerialNumber();
     $mimeData = eZMimeType::findByFileContents($httpFile->attribute('filename'));
     if (!$mimeData['is_valid']) {
         $mimeData = eZMimeType::findByName($httpFile->attribute('mime_type'));
         if (!$mimeData['is_valid']) {
             $mimeData = eZMimeType::findByURL($httpFile->attribute('original_filename'));
         }
     }
     $attr = false;
     $this->removeAliases($attr);
     $this->setOriginalAttributeDataValues($this->ContentObjectAttributeData['id'], $this->ContentObjectAttributeData['version'], $this->ContentObjectAttributeData['language_code']);
     $contentVersion = eZContentObjectVersion::fetchVersion($this->ContentObjectAttributeData['version'], $this->ContentObjectAttributeData['contentobject_id']);
     $objectName = $this->imageName($this->ContentObjectAttributeData, $contentVersion);
     $objectPathString = $this->imagePath($this->ContentObjectAttributeData, $contentVersion, true);
     eZMimeType::changeBaseName($mimeData, $objectName);
     eZMimeType::changeDirectoryPath($mimeData, $objectPathString);
     $httpFile->store(false, false, $mimeData);
     $originalFilename = $httpFile->attribute('original_filename');
     return $this->initialize($mimeData, $originalFilename, $imageAltText);
 }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: checkFileFormat

 /**
  * Tries to validate uploaded file format through handler
  *
  * @param string $handler
  * @param string $option
  * @param eZHTTPFile $file
  * @return boolean	true if file validates or if no validator is defined
  */
 protected static function checkFileFormat($handler, $option, eZHTTPFile $file)
 {
     //Handler instantiation code copied from SQLIImportFactory::runImport
     //TODO : refactoring handler instantiation ?
     $importINI = eZINI::instance('sqliimport.ini');
     $handlerSection = $handler . '-HandlerSettings';
     if (!$importINI->hasSection($handlerSection)) {
         // Check INI Section
         throw new ezcConfigurationNoConfigException('Error : Handler "' . $handler . '" does not have proper config section in sqliimport.ini !');
     }
     if (!$importINI->hasVariable($handlerSection, 'ClassName')) {
         // Check if ClassName is properly defined
         throw new ezcConfigurationNoConfigException('Error : ClassName not defined for "' . $handler . '" in sqliimport.ini !');
     }
     // Default values
     $handlerClassName = $importINI->variable($handlerSection, 'ClassName');
     $handlerEnabled = true;
     $debug = false;
     $defaultParentNodeID = $importINI->variable('ImportSettings', 'DefaultParentNodeID');
     $streamTimeout = $importINI->variable('ImportSettings', 'StreamTimeout');
     if ($importINI->hasVariable($handlerSection, 'Enabled')) {
         $handlerEnabled = $importINI->variable($handlerSection, 'Enabled') === 'true';
     }
     if ($importINI->hasVariable($handlerSection, 'Debug')) {
         $debug = $importINI->variable($handlerSection, 'Debug') === 'enabled';
     }
     if ($importINI->hasVariable($handlerSection, 'DefaultParentNodeID')) {
         $localParentNodeID = $importINI->variable($handlerSection, 'DefaultParentNodeID');
         $defaultParentNodeID = is_int($localParentNodeID) ? (int) $localParentNode : $defaultParentNodeID;
     }
     // Check handler class validity
     if (!class_exists($handlerClassName)) {
         throw new SQLIImportRuntimeException('Error : invalid handler class "' . $handlerClassName . '". Did you regenerate autolads ?');
     }
     $handlerOptions = new SQLIImportHandlerOptions(array());
     $importHandler = new $handlerClassName($handlerOptions);
     if (!$importHandler instanceof ISQLIFileImportHandler) {
         return true;
     }
     $importHandler->handlerConfArray = $importINI->group($handlerSection);
     return $importHandler->validateFile($option, $file->attribute('filename'));
 }
开发者ID:heliopsis,项目名称:SQLIImport,代码行数:50,代码来源:sqliimportjsserverfunctions.php


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