/** * Return the HTML for summarizing a random featured exhibit * * @return string */ function custom_exhibit_builder_display_random_featured_exhibit() { $html = '<div id="featured-exhibit">'; $featuredExhibit = exhibit_builder_random_featured_exhibit(); $html .= '<h2> L\'exposition </h2>'; if ($featuredExhibit) { $html .= '<h3>' . exhibit_builder_link_to_exhibit($featuredExhibit) . '</h3>' . "\n"; $html .= '<p>' . snippet_by_word_count(metadata($featuredExhibit, 'description', array('no_escape' => true))) . '</p>'; } else { $html .= '<p>' . __('You have no featured exhibits.') . '</p>'; } $html .= '</div>'; $html = apply_filters('exhibit_builder_display_random_featured_exhibit', $html); return $html; }
function hijack_exhibit_builder_random_featured_exhibit() { $html = '<div id="featured-exhibit">'; $featuredExhibit = exhibit_builder_random_featured_exhibit(); $html .= '<h2>' . __('Featured Exhibit') . '</h2>'; if ($featuredExhibit) { $html .= '<h3>' . exhibit_builder_link_to_exhibit($featuredExhibit) . '</h3>' . "\n"; if ($item = get_record('Item', array('sort_field' => 'random', 'exhibit' => $featuredExhibit->id, 'hasImage' => true))) { $html .= exhibit_builder_link_to_exhibit($featuredExhibit, item_image('square_thumbnail', array(), 0, $item), array('class' => 'image')); } $html .= '<p class="description">' . snippet_by_word_count(metadata($featuredExhibit, 'description', array('no_escape' => true))) . '</p>'; } else { $html .= '<p>' . __('You have no featured exhibits.') . '</p>'; } $html .= '</div>'; return $html; }
?> " alt="featured Exhibit Image" /> </div> <?php } ?> <!-- <div class="sp-layer sp-static sp-black sp-padding" data-position="bottomLeft" data-height="20%"> --> <div class="featured-text sp-caption"> <h3><?php echo exhibit_builder_link_to_exhibit($featuredExhibit); ?> </h3> <p><?php echo snippet_by_word_count(metadata($featuredExhibit, 'description', array('no_escape' => true)), 200); echo exhibit_builder_link_to_exhibit($featuredExhibit, $text = ' Learn More→'); ?> </p> </div> <!-- </div> --> </div> <?php } ?> </div>
echo __('Browse Timelines'); ?> </h1> <?php if ($total_results) { ?> <?php foreach (loop('Neatline_Time_Timelines') as $timeline) { ?> <div class="timeline"> <h2><?php echo link_to($timeline, 'show', $timeline->title); ?> </h2> <?php echo snippet_by_word_count(metadata($timeline, 'description'), '10'); ?> </div> <?php } ?> <div class="pagination"> <?php echo pagination_links(); ?> </div> <?php } else { ?> <p><?php echo __('You have no timelines.');
public function testSnippetWithWordCountWithHTMLInText() { $phrase = '<a href="url">All goats eat grass.</a>'; $wordCount = 2; $ellipsis = ''; $targetPhrase = 'All goats'; $this->assertEquals($targetPhrase, snippet_by_word_count($phrase, $wordCount, $ellipsis)); }
<li><?php echo link_to_item(__('Delete'), array('class' => 'delete-confirm'), 'delete-confirm'); ?> </li> <?php } ?> </ul> <?php fire_plugin_hook('admin_items_browse_simple_each', array('item' => $item, 'view' => $this)); ?> <div class="details"> <?php echo snippet_by_word_count(strip_formatting(metadata('item', array('Dublin Core', 'Description'))), 40); ?> <p> <strong><?php echo __('Collection'); ?> :</strong> <?php echo link_to_collection_for_item(); ?> </p> <p> <strong><?php echo __('Tags'); ?> :</strong>
<?php echo pagination_links(); ?> <?php foreach (loop('collections') as $collection) { ?> <div class="collection"> <h2><?php echo link_to_collection(); ?> </h2> <?php if ($description = snippet_by_word_count(metadata('collection', array('Dublin Core', 'Description')), 50)) { ?> <div class="description collection-description"> <div class="element-text"><?php echo $description; echo link_to_collection('show more.'); ?> </div> </div> <?php } ?> <div class="meta collection-meta"> <?php if ($collection->hasContributor()) {
<div class="pagination"><?php echo pagination_links(); ?> </div> <?php foreach (loop('NeatlineExhibit') as $e) { ?> <h2> <?php echo nl_getExhibitLink($e, 'show', nl_getExhibitField('title'), array('class' => 'neatline'), true); ?> </h2> <?php if ($description = snippet_by_word_count(nl_getExhibitField('narrative'), 20)) { ?> <div class="neatline-exhibit-description"><?php echo $description . nl_getExhibitLink($e, 'show', 'Read more.', array('class' => 'neatline'), true); ?> </div> <?php } ?> <?php } ?> <div class="pagination"><?php echo pagination_links(); ?>
<div class="exhibit record"> <h3><?php echo exhibit_builder_link_to_exhibit($exhibit); ?> </h3> <?php if ($exhibitImage = record_image($exhibit, 'square_thumbnail')) { ?> <?php echo exhibit_builder_link_to_exhibit($exhibit, $exhibitImage, array('class' => 'image')); ?> <?php } ?> <p><?php echo snippet_by_word_count(metadata($exhibit, 'description', array('no_escape' => true))); ?> </p> </div>