本文整理汇总了PHP中Zend_Feed_Element::key方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Feed_Element::key方法的具体用法?PHP Zend_Feed_Element::key怎么用?PHP Zend_Feed_Element::key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Feed_Element
的用法示例。
在下文中一共展示了Zend_Feed_Element::key方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _mapAttachment
/**
* Maps Zotero attachments to Omeka files, et al.
*
* @param Zend_Feed_Element
* @param bool Flag indicating that this is a top-level attachment.
*/
protected function _mapAttachment(Zend_Feed_Element $element, $topLevelAttachment = false)
{
if (!$topLevelAttachment) {
$this->_elementTexts['Zotero']['Attachment Title'][] = array('text' => $element->title(), 'html' => false);
$urlXpath = '//default:tr[@class="url"]/default:td';
if ($url = $this->_contentXpath($element->content, $urlXpath, true)) {
$this->_elementTexts['Zotero']['Attachment URL'][] = array('text' => $url, 'html' => false);
// If a attachment that is not top-level has no URL, still assign it
// a placeholder to maintain relationships between the "Attachment
// Title" and "Attachment Url" elements.
} else {
$this->_elementTexts['Zotero']['Attachment URL'][] = array('text' => '[No URL]', 'html' => false);
}
}
// The Zotero API will not return a file unless a private key exists, so
// prevent unnecessary requests.
if (!$this->_privateKey) {
return;
}
// Get the file URLs.
$method = "{$this->_libraryType}ItemFile";
$urls = $this->_client->{$method}($this->_libraryId, $element->key());
// Not all attachments have corresponding files in Amazon S3, so return
// those that do not.
if (!$urls['s3']) {
return;
}
// Name the file.
$uri = Zend_Uri::factory($urls['s3']);
// Set the original filename as the basename of the URL path.
$name = urldecode(basename($uri->getPath()));
// Set the file metadata.
$this->_fileMetadata['files'][] = array('source' => $urls['zotero'], 'name' => $name, 'metadata' => array('Dublin Core' => array('Title' => array(array('text' => $element->title(), 'html' => false)), 'Identifier' => array(array('text' => $url, 'html' => false)))));
}