本文整理汇总了PHP中metadata函数的典型用法代码示例。如果您正苦于以下问题:PHP metadata函数的具体用法?PHP metadata怎么用?PHP metadata使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了metadata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emiglio_exhibit_builder_page_nav
function emiglio_exhibit_builder_page_nav($exhibitPage = null, $currentPageId)
{
if (!$exhibitPage) {
$exhibitPage = get_current_record('exhibit_page');
}
$parents = array();
$currentPage = get_record_by_id('Exhibit Page', $currentPageId);
while ($currentPage->parent_id) {
$currentPage = $currentPage->getParent();
array_unshift($parents, $currentPage->id);
}
$class = '';
$class .= $exhibitPage->id == $currentPageId ? 'current' : '';
$parent = array_search($exhibitPage->id, $parents) !== false ? ' parent' : '';
$html = '<li class="' . $class . $parent . '">' . '<a href="' . exhibit_builder_exhibit_uri(get_current_record('exhibit'), $exhibitPage) . '">' . metadata($exhibitPage, 'title') . '</a>';
$children = $exhibitPage->getChildPages();
if ($children) {
$html .= '<ul>';
foreach ($children as $child) {
$html .= emiglio_exhibit_builder_page_nav($child, $currentPageId);
release_object($child);
}
$html .= '</ul>';
}
$html .= '</li>';
return $html;
}
示例2: sliderExhibitAttachment
public function sliderExhibitAttachment($attachment)
{
$item = $attachment->getItem();
$file = $attachment->getFile();
if ($file) {
if (!isset($fileOptions['imgAttributes']['alt'])) {
$fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true));
}
if ($forceImage) {
$imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail';
$image = file_image($imageSize, $fileOptions['imgAttributes'], $file);
$html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item);
} else {
if (!isset($fileOptions['linkAttributes']['href'])) {
$fileOptions['linkAttributes']['href'] = exhibit_builder_exhibit_item_uri($item);
}
$html = file_markup($file, $fileOptions, null);
}
} else {
if ($item) {
$html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item);
}
}
// Don't show a caption if we couldn't show the Item or File at all
if (isset($html)) {
if (!is_string($attachment['caption']) || $attachment['caption'] == '') {
return '';
}
$html .= '<div class="exhibit-item-caption">' . $attachment['caption'] . '</div>';
return apply_filters('exhibit_attachment_caption', $html, array('attachment' => $attachment));
} else {
$html = '';
}
return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage'));
}
示例3: itemGoogleMap
public function itemGoogleMap($item = null, $width = '200px', $height = '200px', $hasBalloonForMarker = false, $markerHtmlClassName = 'geolocation_balloon')
{
$divId = "item-map-{$item->id}";
$location = get_db()->getTable('Location')->findLocationByItem($item, true);
// Only set the center of the map if this item actually has a location
// associated with it
if ($location) {
$center['latitude'] = $location->latitude;
$center['longitude'] = $location->longitude;
$center['zoomLevel'] = $location->zoom_level;
$center['show'] = true;
if ($hasBalloonForMarker) {
$titleLink = link_to_item(metadata($item, array('Dublin Core', 'Title'), array(), $item), array(), 'show', $item);
$thumbnailLink = !item_image('thumbnail') ? '' : link_to_item(item_image('thumbnail', array(), 0, $item), array(), 'show', $item);
$description = metadata($item, array('Dublin Core', 'Description'), array('snippet' => 150), $item);
$center['markerHtml'] = '<div class="' . $markerHtmlClassName . '">' . '<div class="geolocation_balloon_title">' . $titleLink . '</div>' . '<div class="geolocation_balloon_thumbnail">' . $thumbnailLink . '</div>' . '<p class="geolocation_balloon_description">' . $description . '</p></div>';
}
$options = array();
$options['mapType'] = get_option('geolocation_map_type');
$center = js_escape($center);
$options = js_escape($options);
$style = "width: {$width}; height: {$height}";
$html = '<div id="' . $divId . '" class="map geolocation-map" style="' . $style . '"></div>';
$js = "var " . Inflector::variablize($divId) . ";";
$js .= "OmekaMapSingle = new OmekaMapSingle(" . js_escape($divId) . ", {$center}, {$options}); ";
$html .= "<script type='text/javascript'>{$js}</script>";
} else {
$html = '<p class="map-notification">' . __('This item has no location info associated with it.') . '</p>';
}
return $html;
}
示例4: exhibitAttachmentLightboxBook
/**
* Return the markup for displaying an exhibit attachment.
*
* @param ExhibitBlockAttachment $attachment
* @param array $fileOptions Array of options for file_markup
* @param array $linkProps Array of options for exhibit_builder_link_to_exhibit_item
* @param boolean $forceImage Whether to display the attachment as an image
* always Defaults to false.
* @return string
*/
public function exhibitAttachmentLightboxBook($attachment, $fileOptions = array(), $linkProps = array(), $forceImage = false, $pageCount = 0)
{
$item = $attachment->getItem();
$file = $attachment->getFile();
$caption = $attachment['caption'];
if ($file) {
if (!isset($fileOptions['imgAttributes']['alt'])) {
$fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title'));
}
if (!isset($fileOptions['linkAttributes']['data-lightbox'])) {
$fileOptions['linkAttributes']['data-lightbox'] = 'lightbox-gallery';
}
if ($caption) {
$fileOptions['linkAttributes']['data-title'] = $caption;
}
if ($pageCount > 0) {
$fileOptions['linkAttributes']['class'] = "download-file later-pages";
}
if ($forceImage) {
$imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail';
$image = file_image($imageSize, $fileOptions['imgAttributes'], $file);
$html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item);
} else {
$html = file_markup($file, $fileOptions, null);
}
} else {
if ($item) {
$html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item);
}
}
return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage'));
}
示例5: viewAction
public function viewAction()
{
$id = $this->getParam('id');
$item = get_record_by_id('Item', $id);
if (empty($item)) {
throw new Omeka_Controller_Exception_404();
}
$relations = metadata($item, array('Dublin Core', 'Relation'), array('all' => true, 'no_escape' => true, 'no_filter' => true));
// Currently, only support gDoc urls.
$tableUrl = '';
$baseUrl = 'https://spreadsheets.google.com/feeds/list/';
$endUrl = '/public/values';
foreach ($relations as $relation) {
if (strpos($relation, $baseUrl) === 0 && substr_compare($relation, $endUrl, -strlen($endUrl), strlen($endUrl)) === 0) {
$tableUrl = $relation;
break;
}
}
if (empty($tableUrl)) {
$this->_helper->flashMessenger(__('This item has no table of images.'), 'error');
return $this->forward('show', 'items', 'default', array('module' => null, 'controller' => 'items', 'action' => 'show', 'id' => $item->id));
}
$this->_prepareViewer($item);
$this->view->tableUrl = $tableUrl . '?alt=json-in-script&callback=spreadsheetLoaded';
}
示例6: videoStreamSources
/**
* Get the sources for a video stream.
*
* @param Item $item
* @return array The list of sources.
*/
public function videoStreamSources($item = null)
{
$view = $this->view;
if (is_null($item)) {
$item = get_current_record('item');
}
$sources = array();
if (get_option('videostream_jwplayer_flash_streaming')) {
$segmentFlashUrl = metadata($item, array('Streaming Video', 'Video Streaming URL'));
$segmentFlashType = metadata($item, array('Streaming Video', 'Video Type'));
$segmentFlashFile = metadata($item, array('Streaming Video', 'Video Filename'));
$sources[] = array('file' => $segmentFlashUrl . $segmentFlashType . $segmentFlashFile);
}
if (get_option('videostream_jwplayer_http_streaming')) {
$segmentHttpDir = metadata($item, array('Streaming Video', 'HTTP Streaming Directory'));
$segmentHttpFile = metadata($item, array('Streaming Video', 'HTTP Video Filename'));
$sources[] = array('file' => $segmentHttpDir . $segmentHttpFile);
}
if (get_option('videostream_jwplayer_hls_streaming')) {
$segmentHlsDir = metadata($item, array('Streaming Video', 'HLS Streaming Directory'));
$segmentHlsFile = metadata($item, array('Streaming Video', 'HLS Video Filename'));
$sources[] = array('file' => $segmentHlsDir . $segmentHlsFile);
}
return $sources;
}
示例7: itemToDocument
/**
* This takes an Omeka_Record instance and returns a populated
* Apache_Solr_Document.
*
* @param Omeka_Record $item The record to index.
*
* @return Apache_Solr_Document
* @author Eric Rochester <erochest@virginia.edu>
**/
public static function itemToDocument($item)
{
$fields = get_db()->getTable('SolrSearchField');
$doc = new Apache_Solr_Document();
$doc->setField('id', "Item_{$item->id}");
$doc->setField('resulttype', 'Item');
$doc->setField('model', 'Item');
$doc->setField('modelid', $item->id);
// extend $doc to to include and items public / private status
$doc->setField('public', $item->public);
// Title:
$title = metadata($item, array('Dublin Core', 'Title'));
$doc->setField('title', $title);
// Elements:
self::indexItem($fields, $item, $doc);
// Tags:
foreach ($item->getTags() as $tag) {
$doc->setMultiValue('tag', $tag->name);
}
// Collection:
if ($collection = $item->getCollection()) {
$doc->collection = metadata($collection, array('Dublin Core', 'Title'));
}
// Item type:
if ($itemType = $item->getItemType()) {
$doc->itemtype = $itemType->name;
}
$doc->featured = (bool) $item->featured;
// File metadata
foreach ($item->getFiles() as $file) {
self::indexItem($fields, $file, $doc);
}
return $doc;
}
示例8: filterDisplayElements
public function filterDisplayElements($elementSets)
{
if (!($item = get_current_record('item', false))) {
return $elementSets;
}
if (!metadata($item, array('Item Type Metadata', 'Player'))) {
return $elementSets;
}
$newElementSets = array();
foreach ($elementSets as $set => $elements) {
$newElements = $elements;
if ($set === "Moving Image Item Type Metadata") {
$newElements = array();
foreach ($elements as $key => $element) {
if ($key === "Player") {
$playerElement = $element;
} else {
$newElements[$key] = $element;
}
}
}
$newElementSets[$set] = $newElements;
}
if (isset($playerElement)) {
return array_merge(array('Player' => array('' => $playerElement)), $newElementSets);
} else {
return $elementSets;
}
}
示例9: exhibitAttachment
/**
* Return the markup for displaying an exhibit attachment.
*
* @param ExhibitBlockAttachment $attachment
* @param array $fileOptions Array of options for file_markup
* @param array $linkProps Array of options for exhibit_builder_link_to_exhibit_item
* @param boolean $forceImage Whether to display the attachment as an image
* always Defaults to false.
* @return string
*/
public function exhibitAttachment($attachment, $fileOptions = array(), $linkProps = array(), $forceImage = false)
{
$item = $attachment->getItem();
$file = $attachment->getFile();
if ($file) {
if (!isset($fileOptions['imgAttributes']['alt'])) {
$fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true));
}
if ($forceImage) {
$imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail';
$image = file_image($imageSize, $fileOptions['imgAttributes'], $file);
$html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item);
} else {
if (!isset($fileOptions['linkAttributes']['href'])) {
$fileOptions['linkAttributes']['href'] = exhibit_builder_exhibit_item_uri($item);
}
$html = file_markup($file, $fileOptions, null);
}
} else {
if ($item) {
$html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item);
}
}
// Don't show a caption if we couldn't show the Item or File at all
if (isset($html)) {
$html .= $this->view->exhibitAttachmentCaption($attachment);
} else {
$html = '';
}
return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage'));
}
示例10: recordAction
public function recordAction()
{
$item = get_record_by_id("Item", $this->getParam('id'));
$this->view->item = $item;
$this->view->title = is_object($item) ? metadata($this->view->item, array('Dublin Core', 'Title')) : "Untitled";
$this->view->username = is_object($user = current_user()) ? $user->name : "";
$this->view->email = is_object($user) ? $user->email : "";
}
示例11: rhythm_display_date_added
function rhythm_display_date_added($format = 'F j, Y', $item = null)
{
if (!$item) {
$item = get_current_record('item');
}
$dateAdded = metadata($item, 'added');
return date($format, strtotime($dateAdded));
}
示例12: all_items_with_this_subject
function all_items_with_this_subject($args)
{
if (metadata("item", 'Item Type Name') == "Volksverhaaltype") {
$search_url = url(array('module' => 'items', 'controller' => 'browse'), 'default', array("search" => "", "submit_search" => "Zoeken", "advanced[0][element_id]" => "49", "advanced[0][type]" => "is exactly", "advanced[0][terms]" => "{$args}"));
return "{$args} <a class='small blue advanced-search-link button' href='{$search_url}'>alle items van dit type</a>";
}
return $args;
}
示例13: getItemTitle
/**
* Return a item's title.
*
* @param Item $item The item.
* @return string
*/
public static function getItemTitle($item)
{
$title = metadata($item, array('Dublin Core', 'Title'), array('no_filter' => true));
if (!trim($title)) {
$title = '#' . $item->id;
}
return $title;
}
示例14: listContent
function listContent($fileId, $user, $password)
{
$token = autentication($user, $password);
$data_response = executeCurl($token);
if (array_key_exists('error', $data_response)) {
echo "Error: " . $data_response->error->code . " :: " . $data_response->error->message;
} else {
if (array_key_exists('access', $data_response)) {
if (array_key_exists('token', $data_response->access) && array_key_exists('id', $data_response->access->token)) {
$idToken = $data_response->access->token->id;
}
if (array_key_exists('serviceCatalog', $data_response->access) && count($data_response->access->serviceCatalog) > 0 && array_key_exists('endpoints', $data_response->access->serviceCatalog[0]) && array_key_exists('publicURL', $data_response->access->serviceCatalog[0]->endpoints[0])) {
$url = $data_response->access->serviceCatalog[0]->endpoints[0]->publicURL;
}
}
if (strlen($idToken) > 0 && strlen($url) > 0) {
$metadata = metadata($fileId, $idToken, $url);
$list = executeCurl($metadata);
if (array_key_exists('error', $list)) {
echo "Error: {$list->error} :: {$list->description}";
} else {
if (array_key_exists('filename', $list)) {
if ($list->is_folder) {
echo "<div style=\"font-family:'Verdana';font-size:15px;\"><p><b><span style='text-decoration:underline'>{$list->filename}</span></b> (Directorio)</p>";
if (array_key_exists('contents', $list)) {
$childrens = count($list->contents);
if ($childrens > 0) {
echo "Número de elementos contenidos: {$childrens}<br><br></div>";
echo "<table width=\"100%\" border=\"1\">";
echo "<tr style=\"font-family:'Verdana';font-size:15px;font-weight:bold;background-color:lightgrey\" align='center'><td width=\"10%\">Tipo</td><td width=\"35%\">Id</td><td width=\"35%\">Nombre</td><td width=\"20%\">Tamaño</td></tr>";
foreach ($list->contents as $meta) {
if ($meta->is_folder) {
$data = "<img src=\"/eyeos/extern/images/48x48/places/folder-documents.png\" align=\"middle\"/>";
} else {
$path = "/eyeos/extern/images/48x48/mimetypes/text-plain.png";
if (strrpos($meta->filename, 'jpg') !== false || strrpos($meta->filename, 'png') !== false) {
$path = "/eyeos/extern/images/48x48/mimetypes/application-x-egon.png";
} elseif (strrpos($meta->filename, 'pdf') !== false) {
$path = "/eyeos/extern/images/48x48/mimetypes/application-pdf.png";
}
$data = "<img src='" . $path . "' align=\"middle\"/>";
}
echo "<tr style=\"font-family:'Verdana';font-size:13px;\" align='center'><td>{$data}</td><td>{$meta->file_id}</td><td>{$meta->filename}</td><td>{$meta->size}</td></tr>";
}
echo "</table>";
} else {
echo "<br><br>No contiene ni ficheros ni directorios<br></div>";
}
}
} else {
echo "<div style=\"font-family:'Verdana';font-size:15px;\"><p><b><span style='text-decoration:underline'>{$list->filename}</span></b> (Fichero)</p>";
echo "No se pueden encontrar dependencias de un archivo</div>";
}
}
}
}
}
}
示例15: testRandomFeaturedItems
public function testRandomFeaturedItems()
{
$randomFeaturedItems = get_random_featured_items();
$this->assertEquals(5, count($randomFeaturedItems));
$randomFeaturedItemsWithImages = get_random_featured_items('5', true);
$this->assertEquals(5, count($randomFeaturedItemsWithImages));
foreach ($randomFeaturedItemsWithImages as $randomItem) {
$this->assertTrue(metadata($randomItem, 'has files'));
}
}