public function findPairsForSelectForm(array $options = array()) { $db = $this->getDb(); $subquery = new Omeka_Db_Select(); $subquery->from(array('element_texts' => $db->ElementText), 'id'); $subquery->joinInner(array('elements' => $db->Element), 'elements.id = element_texts.element_id', array()); $subquery->joinInner(array('element_sets' => $db->ElementSet), 'element_sets.id = elements.element_set_id', array()); $subquery->where("element_sets.name = 'Dublin Core'"); $subquery->where("elements.name = 'Title'"); $subquery->where("element_texts.record_type = 'Collection'"); $subquery->where('element_texts.record_id = collections.id'); $subquery->limit(1); $select = $this->getSelectForFindBy($options); $select->joinLeft(array('element_texts' => $db->ElementText), "element_texts.id = ({$subquery})", array()); $select->reset(Zend_Db_Select::COLUMNS); $select->from(array(), array('collections.id', 'element_texts.text')); $select->order('element_texts.text'); $pairs = $db->fetchPairs($select); foreach ($pairs as $collectionId => &$name) { if ($name === null || $name == '') { $name = __('[Untitled] #%s', $collectionId); } else { $name = strip_formatting($name); } } return $pairs; }
function show_untitled_items($title) { // Remove all whitespace and formatting before checking to see if the title // is empty. $prepTitle = trim(strip_formatting($title)); if (empty($prepTitle)) { return __('[Untitled]'); } return $title; }
public function testCanSetValidPropertiesForCollection() { // build the collection $this->builder->setRecordMetadata(array('public' => true, 'featured' => false, 'owner_id' => self::USER_ID)); $elementTexts = array('Dublin Core' => array('Title' => array(array('text' => 'foobar', 'html' => false)), 'Description' => array(array('text' => 'foobar desc', 'html' => false)))); $this->builder->setElementTexts($elementTexts); $collection = $this->builder->build(); $this->assertEquals('foobar', strip_formatting(metadata($collection, array('Dublin Core', 'Title')))); $this->assertEquals('foobar desc', strip_formatting(metadata($collection, array('Dublin Core', 'Description')))); $this->assertEquals("1", $collection->public); $this->assertEquals("0", $collection->featured); $this->assertEquals(self::USER_ID, $collection->owner_id, "Collection's 'owner_id' column should have been set."); }
/** * Return a link to an item within an exhibit. * * @param string $text Link text (by default, the item title is used) * @param array $props Link attributes * @param Item $item If null, will use the current item. * @return string */ function exhibit_builder_link_to_exhibit_item($text = null, $props = array(), $item = null) { if (!$item) { $item = get_current_record('item'); } if (!isset($props['class'])) { $props['class'] = 'exhibit-item-link'; } $uri = exhibit_builder_exhibit_item_uri($item); $text = !empty($text) ? $text : strip_formatting(metadata($item, array('Dublin Core', 'Title'))); $html = '<a href="' . html_escape($uri) . '" ' . tag_attributes($props) . '>' . $text . '</a>'; $html = apply_filters('exhibit_builder_link_to_exhibit_item', $html, array('text' => $text, 'props' => $props, 'item' => $item)); return $html; }
protected function itemToRSS($item) { $entry = array(); set_current_record('item', $item, true); // Title is a CDATA section, so no need for extra escaping. $entry['title'] = strip_formatting(metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true))); $entry['description'] = $this->buildDescription($item); $entry['link'] = xml_escape(record_url($item, null, true)); $entry['lastUpdate'] = strtotime($item->added); //List the first file as an enclosure (only one per RSS feed) if (($files = $item->Files) && ($file = current($files))) { $entry['enclosure'] = array(); $fileDownloadUrl = file_display_url($file); $enc['url'] = $fileDownloadUrl; $enc['type'] = $file->mime_type; $enc['length'] = (int) $file->size; $entry['enclosure'][] = $enc; } return $entry; }
<!DOCTYPE html> <html lang="<?php echo get_html_lang(); ?> "> <head> <meta charset="utf-8"> <title><?php echo __('Omeka Admin'); ?> : <?php echo option('site_title'); echo isset($title) ? ' | ' . strip_formatting($title) : ''; ?> </title> <?php queue_css_file(array('style', 'skeleton', 'jquery-ui')); queue_css_file('media/960min', 'only screen and (min-width: 960px)'); queue_css_file('media/768min', 'only screen and (min-width: 768px) and (max-width: 959px)'); queue_css_file('media/767max', 'only screen and (max-width: 767px)'); queue_css_file('media/479max', 'only screen and (max-width: 479px)'); queue_css_url('https://fonts.googleapis.com/css?family=Arvo:400,700,400italic,700italic|Cabin:400,700,400italic,700italic'); queue_js_file(array('vendor/respond', 'vendor/modernizr', 'vendor/selectivizr', 'globals')); ?> <!-- Stylesheets --> <?php echo head_css(); ?>
echo all_element_texts('collection'); ?> <div id="collection-items"> <!--<h2><?php echo link_to_items_browse(__('Items in the %', $collectionTitle), array('collection' => metadata('collection', 'id'))); ?> </h2>--> <?php if (metadata('collection', 'total_items') > 0) { ?> <?php foreach (loop('items') as $item) { ?> <?php $itemTitle = strip_formatting(metadata('item', array('Dublin Core', 'Title'))); ?> <div class="item hentry"> <h3><?php echo link_to_item($itemTitle, array('class' => 'permalink')); ?> </h3> <?php if (metadata('item', 'has thumbnail')) { ?> <div class="item-img"> <?php echo link_to_item(item_image('square_thumbnail', array('alt' => $itemTitle))); ?> </div>
public function hookPublicCollectionsShow() { if (get_option(SocialBookmarkingPlugin::ADD_TO_OMEKA_COLLECTIONS_OPTION) == '1') { $collection = get_current_record('collection'); $url = record_url($collection, 'show', true); $title = strip_formatting(metadata($collection, array('Dublin Core', 'Title'))); $description = strip_formatting(metadata($collection, array('Dublin Core', 'Description'))); echo '<h2>' . __('Social Bookmarking') . '</h2>'; echo social_bookmarking_toolbar($url, $title, $description); } }
/** * Get a property or special value of this record. * * @param string $property * @return mixed */ public function getProperty($property) { switch ($property) { case 'uri': return $this->getWebPath('original'); case 'fullsize_uri': return $this->getWebPath('fullsize'); case 'thumbnail_uri': return $this->getWebPath('thumbnail'); case 'square_thumbnail_uri': return $this->getWebPath('square_thumbnail'); case 'permalink': return absolute_url(array('controller' => 'files', 'action' => 'show', 'id' => $this->id)); case 'display_title': $titles = $this->getElementTexts('Dublin Core', 'Title'); if ($titles) { $title = strip_formatting($titles[0]->text); } else { $title = $this->original_filename; } return $title; default: return parent::getProperty($property); } }
<?php $fileTitle = metadata('file', array('Dublin Core', 'Title')) ? strip_formatting(metadata('file', array('Dublin Core', 'Title'))) : metadata('file', 'original filename'); if ($fileTitle != '') { $fileTitle = ': "' . $fileTitle . '" '; } else { $fileTitle = ''; } $fileTitle = __('File #%s', metadata('file', 'id')) . $fileTitle; echo head(array('title' => $fileTitle, 'bodyclass' => 'files show primary-secondary')); ?> <div class="container single-item"> <div class="content-block"> <h1><?php echo $fileTitle; ?> </h1> <div class="row"> <div class="col-sm-5"> <?php echo file_markup($file, array('imageSize' => 'original')); ?> </div> <div class="col-sm-7"> <?php echo all_element_texts('file'); ?> <div id="original-filename" class="element"> <h6><?php echo __('Original Filename');
<?php /** * The edit query view for a specific Timeline. */ $timelineTitle = metadata($neatline_time_timeline, 'title'); $title = __('Neatline Time | Edit "%s" Items Query', strip_formatting($timelineTitle)); $head = array('bodyclass' => 'timelines primary', 'title' => $title); echo head($head); ?> <script type="text/javascript" charset="utf-8"> jQuery(window).load(function(){ Omeka.Search.activateSearchButtons; }); </script> <?php $query = unserialize($neatline_time_timeline->query); if ($query && is_array($query)) { ?> <p><strong><?php echo __('The “%s” timeline displays items that match the following query:', $timelineTitle); ?> </strong></p> <?php echo item_search_filters($query); } echo items_search_form(array(), current_url()); echo foot();
/** * Get a title suitable for display through metadata() * * @return string */ public function getDisplayTitle() { $titles = $this->getElementTexts('Dublin Core', 'Title'); if ($titles) { $title = $titles[0]->text; if ($titles[0]->html) { $title = html_entity_decode(strip_formatting($title), ENT_QUOTES, 'UTF-8'); } } else { $title = $this->original_filename; } return $title; }
/** * Add a link for the file based on the given set of options. * * If the 'linkToMetadata' option is true, then link to the file * metadata page (files/show). If 'linkToFile' is true, * link to the original file, and if 'linkToFile' is a string, try * to link to that specific derivative. Otherwise just return the * $html without wrapping in a link. * * The attributes for the link will be based off the 'linkAttributes' * option, which should be an array. * * If $html is null, it defaults to original filename of the file. * * @param File $file * @param array $options * @param string $html * @return string */ protected function _linkToFile($file, $options, $html = null) { if ($html === null) { $fileTitle = strip_formatting(metadata($file, array('Dublin Core', 'Title'))); $html = $fileTitle ? $fileTitle : metadata($file, 'Original Filename'); } if ($options['linkToMetadata']) { $html = link_to_file_show((array) $options['linkAttributes'], $html, $file); } else { if ($linkToFile = $options['linkToFile']) { // If you've manually specified a derivative type to link // to, and this file actually has derivatives, we'll use // that, otherwise, the link is to the "original" file. if (is_string($linkToFile) && $file->hasThumbnail()) { $derivative = $linkToFile; } else { $derivative = 'original'; } // Wrap in a link that will download the file directly. $defaultLinkAttributes = array('class' => 'download-file', 'href' => $file->getWebPath($derivative)); $linkAttributes = array_key_exists('linkAttributes', $options) ? $options['linkAttributes'] : array(); $linkAttributes = array_merge($defaultLinkAttributes, $linkAttributes); $html = '<a ' . tag_attributes($linkAttributes) . '>' . $html . '</a>'; } } return $html; }
/** * Display the links to the catalogs on the public item page. */ public function hookPublicItemsShow() { $item = get_current_record('item'); $subject_full = strip_formatting(metadata($item, array('Dublin Core', 'Subject'))); $subject_simple = cleanSubjectString($subject_full); /* Only display the links if the item has a subject */ if ($subject_full !== "") { echo "<div id='catalog-search' class='element'>"; echo "<h3>" . __("Catalog Search") . "</h3>"; echo "<p>" . __("Search for related records in these catalogs:") . "</p>"; $searches = get_db()->getTable('CatalogSearchSearch')->getAllCatalogSearches(); foreach ($searches as $search) { // Decide whether to use full or simple query terms. if ($search->query_type == '0') { $subject_use = $subject_full; } elseif ($search->query_type == '1') { $subject_use = $subject_simple; } // Echo the search link to the catalog. echo "<div class='element-text'><a href='" . getCatalogSearchUrl($search->query_string, $subject_use) . "'>" . $search->catalog_name . "</a></div>"; } echo "</div>"; } }
<?php $userTitle = strip_formatting($user->username); if ($userTitle != '') { $userTitle = ': "' . html_escape($userTitle) . '" '; } else { $userTitle = ''; } $userTitle = __('Edit User #%s', $user->id) . $userTitle; echo head(array('title' => $userTitle, 'bodyclass' => 'users')); echo common('users-nav', array('user' => $user)); echo flash(); ?> <form method="post" action=""> <h3><?php echo __('API Keys'); ?> </h3> <div class="field"> <div class="two columns alpha"> <label for="search_record_types"><?php echo __('New key label'); ?> </label> </div> <div class="inputs five columns omega"> <p class="explanation"><?php echo __('To create a new API key, enter a label for the key below. For example, ' . 'describe for what purpose it will be used. This key will have all your ' . 'permissions; treat it as you would your password.'); ?> </p> <?php
<div class="collection record"> <?php $title = metadata($collection, array('Dublin Core', 'Title')); $description = metadata($collection, array('Dublin Core', 'Description'), array('snippet' => 150)); ?> <h3><?php echo link_to($this->collection, 'show', strip_formatting($title)); ?> </h3> <?php if ($collectionImage = record_image($collection, 'square_thumbnail')) { ?> <?php echo link_to($this->collection, 'show', $collectionImage, array('class' => 'image')); ?> <?php } ?> <?php if ($description) { ?> <p class="collection-description"><?php echo $description; ?> </p> <?php } ?> </div>
public function filterItemSearchFilters($displayArray, $args) { $request_array = $args['request_array']; if (isset($request_array['multi-collection'])) { $collection = $this->_db->getTable('Collection')->find($request_array['multi-collection']); $displayValue = strip_formatting(metadata($collection, array('Dublin Core', 'Title'))); $displayArray['collection'] = $displayValue; } return $displayArray; }
<div class="item record"> <?php $title = metadata($item, array('Dublin Core', 'Title')); $description = metadata($item, array('Dublin Core', 'Description'), array('snippet' => 150)); ?> <h3><?php echo link_to($item, 'show', strip_formatting($title)); ?> </h3> <?php if (metadata($item, 'has files')) { echo link_to_item(item_image('square_thumbnail', array(), 0, $item), array('class' => 'image'), 'show', $item); } ?> <?php if ($description) { ?> <p class="item-description"><?php echo $description; ?> </p> <?php } ?> </div>
/** * Return a valid citation for this item. * * Generally follows Chicago Manual of Style note format for webpages. * Implementers can use the item_citation filter to return a customized * citation. * * @return string */ function getCitation() { $citation = ''; $creators = metadata($this, array('Dublin Core', 'Creator'), array('all' => true)); // Strip formatting and remove empty creator elements. $creators = array_filter(array_map('strip_formatting', $creators)); if ($creators) { switch (count($creators)) { case 1: $creator = $creators[0]; break; case 2: /// Chicago-style item citation: two authors $creator = __('%1$s and %2$s', $creators[0], $creators[1]); break; case 3: /// Chicago-style item citation: three authors $creator = __('%1$s, %2$s, and %3$s', $creators[0], $creators[1], $creators[2]); break; default: /// Chicago-style item citation: more than three authors $creator = __('%s et al.', $creators[0]); } $citation .= "{$creator}, "; } $title = strip_formatting(metadata($this, array('Dublin Core', 'Title'))); if ($title) { $citation .= "“{$title},” "; } $siteTitle = strip_formatting(option('site_title')); if ($siteTitle) { $citation .= "<em>{$siteTitle}</em>, "; } $accessed = format_date(time(), Zend_Date::DATE_LONG); $url = '<span class="citation-url">' . html_escape(record_url($this, null, true)) . '</span>'; /// Chicago-style item citation: access date and URL $citation .= __('accessed %1$s, %2$s.', $accessed, $url); return apply_filters('item_citation', $citation, array('item' => $this)); }
public function filterItemCitation($cite, $args) { $item = $args['item']; if (!$item) { return $cite; } $contribItem = $this->_db->getTable('ContributionContributedItem')->findByItem($item); if (!$contribItem) { return $cite; } $title = metadata('item', array('Dublin Core', 'Title')); $siteTitle = strip_formatting(option('site_title')); $itemId = $item->id; $accessDate = date('F j, Y'); $uri = html_escape(record_url($item, 'show', true)); if ($contribItem->anonymous) { $cite = __("Anonymous, "); } else { $cite = $contribItem->Contributor->name . ", "; } $cite .= "“{$title},” "; if ($siteTitle) { $cite .= "<em>{$siteTitle}</em>, "; } $cite .= "accessed {$accessDate}, "; $cite .= "{$uri}."; return $cite; }
<?php $collectionTitle = strip_formatting(metadata('collection', array('Dublin Core', 'Title'), array('no_filter' => true))); if ($collectionTitle != '') { $collectionTitle = ': "' . $collectionTitle . '" '; } else { $collectionTitle = ''; } $collectionTitle = __('Edit Collection #%s', metadata('collection', 'id')) . $collectionTitle; ?> <?php echo head(array('title' => $collectionTitle, 'bodyclass' => 'collections')); include 'form-tabs.php'; echo flash(); ?> <form method="post"> <?php include 'form.php'; ?> <section class="three columns omega"> <div id="save" class="panel"> <input type="submit" name="submit" class="big green button" id="save-changes" value="<?php echo __('Save Changes'); ?> " /> <a href="<?php echo html_escape(public_url('collections/show/' . metadata('collection', 'id'))); ?>
<?php $type_name = strip_formatting($item_type->name); if ($type_name != '') { $type_name = ': "' . html_escape($type_name) . '" '; } else { $type_name = ''; } $title = __('Edit Item Type #%s', $item_type->id) . $type_name; echo head(array('title' => $title, 'bodyclass' => 'item-types')); echo flash(); ?> <form method="post" action=""> <?php include 'form.php'; ?> <section class="three columns omega"> <div id="save" class="panel"> <input type="submit" class="big green button" name="submit" value="<?php echo __('Save Changes'); ?> "> <?php if (is_allowed('ItemTypes', 'delete')) { ?> <?php echo link_to($item_type, 'delete-confirm', __('Delete'), array('class' => 'big red button delete-confirm')); ?> <?php }
<?php $collectionTitle = strip_formatting(metadata('collection', array('Dublin Core', 'Title'))); if ($collectionTitle == '') { $collectionTitle = __('[Untitled]'); } ?> <?php echo head(array('title' => $collectionTitle, 'bodyclass' => 'collections show')); ?> <h2><?php echo $collectionTitle; ?> </h2> <div id="description" class="element"> <div class="element-text"><?php echo metadata('collection', array('Dublin Core', 'Description')); ?> </div> </div><!-- end description --> <div id="collection-items span12"> <ul class="thumbnails"> <?php $collection_items = get_records('Item', array('collection' => $collection['id'], 'sort_field' => 'Scripto,Weight', 'sort_dir' => 'a'), 999); set_loop_records('items', $collection_items); foreach (loop('items') as $item) {
protected function _getElementMetadata($item, $elementSetName, $elementName) { $m = new Omeka_View_Helper_Metadata(); return strip_formatting($m->metadata($item, array($elementSetName, $elementName))); }
echo __('Items'); ?> </h2> <div class="five columns omega"> <ul> <?php $itemCheckboxes = array(); foreach ($itemIds as $id) { if (!($item = get_record_by_id('item', $id))) { continue; } $showItemFields = true; if (!is_allowed($item, 'edit') || !is_allowed($item, 'delete')) { $showItemFields = false; } $itemCheckboxes[$id] = strip_formatting(metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true))); release_object($item); } echo '<li>' . $this->formMultiCheckbox('items[]', null, array('checked' => 'checked'), $itemCheckboxes, '</li><li>') . '</li>'; ?> </ul> <p class="explanation"><?php echo __('Changes will be applied to checked items.'); ?> </p> </div> </fieldset> <fieldset id="item-fields"> <h2><?php echo __('Item Metadata');
<p>Drag and drop the items below to change their order.</p> <p>Changes are saved automatically.</p> <p><a href="<?php echo url('collections/show/' . $collection->id); ?> ">Click here</a> to return to the collection show page.</p> <p id="message" style="color: green;"></p> <ul id="sortable"> <?php foreach ($items as $item) { ?> <?php $itemObj = get_record_by_id('item', $item['id']); $title = strip_formatting(metadata($itemObj, array('Dublin Core', 'Title'))); $creator = strip_formatting(metadata($itemObj, array('Dublin Core', 'Creator'))); $dateAdded = format_date(strtotime($item['added']), Zend_Date::DATETIME_MEDIUM); ?> <li id="items-<?php echo html_escape($item['id']); ?> " class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span> <em><?php echo html_escape($title); ?> </em> <br/> by <?php echo $creator ? html_escape($creator) : '[no creator]'; ?> (added <?php
/** * Return a substring of the text by limiting the word count. * * Note: it strips the HTML tags from the text before getting the snippet * * @package Omeka\Function\Text * @param string $text * @param integer $maxWords * @param string $ellipsis * @return string */ function snippet_by_word_count($text, $maxWords = 20, $ellipsis = '...') { // strip html tags from the text $text = strip_formatting($text); if ($maxWords > 0) { $textArray = explode(' ', $text); if (count($textArray) > $maxWords) { $text = implode(' ', array_slice($textArray, 0, $maxWords)) . $ellipsis; } } else { return ''; } return $text; }
<?php /** * The edit view for the Timelines administrative panel. */ $timelineTitle = timeline('title') ? strip_formatting(timeline('title')) : '[Untitled]'; $title = __('Neatline Time | Edit "%s" Metadata', $timelineTitle); $head = array('bodyclass' => 'timelines primary', 'title' => html_escape($title)); echo head($head); echo $form; echo foot();
<meta name="viewport" content="width=device-width, initial-scale=1"> <?php if ($description = option('description')) { ?> <meta name="description" content="<?php echo $description; ?> " /> <?php } ?> <!-- Will build the page <title> --> <?php if (isset($title)) { $titleParts[] = strip_formatting($title); } $titleParts[] = option('site_title'); ?> <title><?php echo implode(' · ', $titleParts); ?> </title> <link href='https://fonts.googleapis.com/css?family=Droid+Serif' rel='stylesheet' type='text/css'> <?php echo auto_discovery_link_tags(); ?> <!-- Will fire plugins that need to include their own files in <head> --> <?php
protected function _buildManifestBase($record, $asObject = true) { $recordClass = get_class($record); $manifest = array(); $manifest['@id'] = absolute_url(array('recordtype' => Inflector::tableize($recordClass), 'id' => $record->id), 'universalviewer_presentation_manifest'); $manifest['@type'] = $recordClass == 'Collection' ? 'sc:Collection' : 'sc:Manifest'; $manifest['label'] = strip_formatting(metadata($record, array('Dublin Core', 'Title'), array('no_filter' => true))) ?: __('[Untitled]'); return $asObject ? (object) $manifest : $manifest; }