本文整理匯總了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)))));
}