本文整理汇总了PHP中strip_formatting函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_formatting函数的具体用法?PHP strip_formatting怎么用?PHP strip_formatting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_formatting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findPairsForSelectForm
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;
}
示例2: show_untitled_items
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;
}
示例3: testCanSetValidPropertiesForCollection
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.");
}
示例4: exhibit_builder_link_to_exhibit_item
/**
* 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;
}
示例5: itemToRSS
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;
}
示例6: get_html_lang
<!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();
?>
示例7: all_element_texts
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>
示例8: hookPublicCollectionsShow
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);
}
}
示例9: getProperty
/**
* 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);
}
}
示例10: metadata
<?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');
示例11: metadata
<?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();
示例12: getDisplayTitle
/**
* 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;
}
示例13: _linkToFile
/**
* 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;
}
示例14: hookPublicItemsShow
/**
* 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>";
}
}
示例15: strip_formatting
<?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