本文整理汇总了PHP中TYPO3\CMS\Core\Resource\File::_getMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP File::_getMetaData方法的具体用法?PHP File::_getMetaData怎么用?PHP File::_getMetaData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\File
的用法示例。
在下文中一共展示了File::_getMetaData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUri
/**
* @param File $file
* @return string
*/
protected function getUri(File $file)
{
$metadataProperties = $file->_getMetaData();
$parameterName = sprintf('edit[sys_file_metadata][%s]', $metadataProperties['uid']);
$uri = BackendUtility::getModuleUrl('record_edit', array($parameterName => 'edit', 'returnUrl' => BackendUtility::getModuleUrl(GeneralUtility::_GP('M'), $this->getAdditionalParameters())));
return $uri;
}
示例2: extractMetaData
/**
* Extract metadata for given fileObject
*
* @param File $fileObject
*/
public function extractMetaData(File $fileObject)
{
$newMetaData = [0 => $fileObject->_getMetaData()];
// Loop through available extractors and fetch metadata for the given file.
foreach ($this->getExtractionServices() as $service) {
if ($this->isFileTypeSupportedByExtractor($fileObject, $service) && $service->canProcess($fileObject)) {
$newMetaData[$service->getPriority()] = $service->extractMetaData($fileObject, $newMetaData);
}
}
// Sort metadata by priority so that merging happens in order of precedence.
ksort($newMetaData);
// Merge the collected metadata.
$metaData = [];
foreach ($newMetaData as $data) {
$metaData = array_merge($metaData, $data);
}
$fileObject->_updateMetaDataProperties($metaData);
$this->getMetaDataRepository()->update($fileObject->getUid(), $metaData);
$this->getFileIndexRepository()->updateIndexingTime($fileObject->getUid());
}
示例3: linkWrapFile
/**
* Wraps filenames in links which opens the metadata editor.
*
* @param string $code String to be wrapped in links
* @param File $fileObject File to be linked
* @return string HTML
*/
public function linkWrapFile($code, File $fileObject)
{
try {
if ($fileObject instanceof File && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
$metaData = $fileObject->_getMetaData();
$data = array('sys_file_metadata' => array($metaData['uid'] => 'edit'));
$editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), '', $this->listUrl());
$title = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
$code = '<a href="#" title="' . $title . '" onclick="' . htmlspecialchars($editOnClick) . '">' . GeneralUtility::fixed_lgd_cs($code, $this->fixedL) . '</a>';
}
} catch (\Exception $e) {
// intentional fall-through
}
return $code;
}
示例4: migrateFileFromDamToFal
/**
* migrate file from dam record to fal system
*
* @param array $damRecord
* @param \TYPO3\CMS\Core\Resource\File $fileObject
* @throws \Exception
* @return void
*/
protected function migrateFileFromDamToFal(array $damRecord, \TYPO3\CMS\Core\Resource\File $fileObject)
{
// in getProperties() we don't have the required UID of metadata record
// if no metadata record is available it will automatically created within FAL
$metadataRecord = $fileObject->_getMetaData();
if (is_array($metadataRecord)) {
// update existing record
$this->database->exec_UPDATEquery('sys_file_metadata', 'uid = ' . $metadataRecord['uid'], $this->createArrayForUpdateInsertSysFileRecord($damRecord));
// add the migrated uid of the DAM record to the FAL record
$this->database->exec_UPDATEquery('sys_file', 'uid = ' . $fileObject->getUid(), array('_migrateddamuid' => $damRecord['uid']));
}
}
示例5: cleanupCategoryReferences
/**
* Remove all category references of the deleted file.
*
* @param File $fileObject
* @return void
*/
protected function cleanupCategoryReferences(File $fileObject)
{
// Retrieve the file metadata uid which is different from the file uid.
$metadataProperties = $fileObject->_getMetaData();
$metaDataUid = isset($metadataProperties['_ORIG_uid']) ? $metadataProperties['_ORIG_uid'] : $metadataProperties['uid'];
$this->getDatabaseConnection()->exec_DELETEquery('sys_category_record_mm', 'uid_foreign=' . (int) $metaDataUid . ' AND tablenames = \'sys_file_metadata\'');
}
示例6: linkWrapFile
/**
* Wraps filenames in links which opens the metadata editor.
*
* @param string $code String to be wrapped in links
* @param File $fileObject File to be linked
* @return string HTML
*/
public function linkWrapFile($code, File $fileObject)
{
try {
if ($fileObject instanceof File && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
$metaData = $fileObject->_getMetaData();
$urlParameters = ['edit' => ['sys_file_metadata' => [$metaData['uid'] => 'edit']], 'returnUrl' => $this->listURL()];
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
$title = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
$code = '<a href="' . htmlspecialchars($url) . '" title="' . $title . '">' . GeneralUtility::fixed_lgd_cs($code, $this->fixedL) . '</a>';
}
} catch (\Exception $e) {
// intentional fall-through
}
return $code;
}
示例7: extractMetaData
/**
* Extract metadata for given fileObject
*
* @param File $fileObject
*/
public function extractMetaData(File $fileObject)
{
$newMetaData = array(0 => $fileObject->_getMetaData());
foreach ($this->getExtractionServices() as $service) {
if ($service->canProcess($fileObject)) {
$newMetaData[$service->getPriority()] = $service->extractMetaData($fileObject, $newMetaData);
}
}
ksort($newMetaData);
$metaData = array();
foreach ($newMetaData as $data) {
$metaData = array_merge($metaData, $data);
}
$fileObject->_updateMetaDataProperties($metaData);
$this->getMetaDataRepository()->update($fileObject->getUid(), $metaData);
$this->getFileIndexRepository()->updateIndexingTime($fileObject->getUid());
}
示例8: getFileMetadataIdentifier
/**
* Retrieve the file metadata uid which is different from the file uid.
*
* @param \TYPO3\CMS\Core\Resource\File $file
* @return int
*/
protected function getFileMetadataIdentifier(File $file)
{
$metadataProperties = $file->_getMetaData();
return isset($metadataProperties['_ORIG_uid']) ? (int) $metadataProperties['_ORIG_uid'] : (int) $metadataProperties['uid'];
}