本文整理汇总了PHP中trim_characters函数的典型用法代码示例。如果您正苦于以下问题:PHP trim_characters函数的具体用法?PHP trim_characters怎么用?PHP trim_characters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trim_characters函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
$plural = $row['contentcount'] == 1 ? 'speech' : 'speeches';
$moreinfo[] = $row['contentcount'] . " {$plural}";
}
if ($row['totalcomments'] > 0) {
$plural = $row['totalcomments'] == 1 ? 'annotation' : 'annotations';
$moreinfo[] = $row['totalcomments'] . " {$plural}";
}
if (count($moreinfo) > 0) {
print "<small>(" . implode(', ', $moreinfo) . ") </small>";
}
} else {
// Nothing in this item, so no link.
print $row['body'];
}
if (isset($row['excerpt'])) {
print "<p class=\"subrows__excerpt\">" . trim_characters($row['excerpt'], 0, 200) . "</p>";
}
}
print '</ul></div></div></div>';
}
if ($individual_item) {
?>
<div class="debate-comments">
<div class="full-page__row">
<div class="full-page__unit">
<?php
# XXX
global $PAGE;
$comments['object']->display('ep', $comments['args']);
$PAGE->comment_form($comments['commentdata']);
# XXX COMMENT SIDEBAR SHOULD GO HERE IF LOGGED IN
示例2: prepare_search_result_for_display
function prepare_search_result_for_display($body)
{
global $SEARCHENGINE;
// We want to trim the body to an extract that is centered
// around the position of the first search word.
// we don't use strip_tags as it doesn't replace tags with spaces,
// which means some words end up stuck together
$extract = strip_tags_tospaces($body);
// $bestpos is the position of the first search word
$bestpos = $SEARCHENGINE->position_of_first_word($extract);
// Where do we want to extract from the $body to start?
$length_of_extract = 400;
// characters.
$startpos = $bestpos - $length_of_extract / 2;
if ($startpos < 0) {
$startpos = 0;
}
// Trim it to length and position, adding ellipses.
$extract = trim_characters($extract, $startpos, $length_of_extract);
// Highlight search words
$extract = $SEARCHENGINE->highlight($extract);
return $extract;
}
示例3: _get_data_by_search
//.........这里部分代码省略.........
}
// Get the data for the gid from the database
$q = $this->db->query("SELECT hansard.gid,\n hansard.hdate,\n hansard.section_id,\n hansard.subsection_id,\n hansard.htype,\n hansard.major,\n hansard.speaker_id,\n\t\t\t\t hansard.hpos,\n epobject.body\n FROM hansard, epobject\n WHERE hansard.gid = '{$gid}'\n AND hansard.epobject_id = epobject.epobject_id");
if ($q->rows() > 1) {
$PAGE->error_message("Got more than one row getting data for {$gid}");
}
if ($q->rows() == 0) {
# This error message is totally spurious, so don't show it
# $PAGE->error_message("Unexpected missing gid $gid while searching");
continue;
}
$itemdata = array();
$itemdata['gid'] = fix_gid_from_db($q->field(0, 'gid'));
$itemdata['hdate'] = $q->field(0, 'hdate');
$itemdata['htype'] = $q->field(0, 'htype');
$itemdata['major'] = $q->field(0, 'major');
$itemdata['section_id'] = $q->field(0, 'section_id');
$itemdata['subsection_id'] = $q->field(0, 'subsection_id');
$itemdata['relevance'] = $relevances[$n];
$itemdata['speaker_id'] = $q->field(0, 'speaker_id');
$itemdata['hpos'] = $q->field(0, 'hpos');
//////////////////////////
// 1. Trim and highlight the body text.
$body = $q->field(0, 'body');
// We want to trim the body to an extract that is centered
// around the position of the first search word.
// we don't use strip_tags as it doesn't replace tags with spaces,
// which means some words end up stuck together
$extract = strip_tags_tospaces($body);
// $bestpos is the position of the first search word
$bestpos = $SEARCHENGINE->position_of_first_word($extract);
// Where do we want to extract from the $body to start?
$length_of_extract = 400;
// characters.
$startpos = $bestpos - $length_of_extract / 2;
if ($startpos < 0) {
$startpos = 0;
}
// Trim it to length and position, adding ellipses.
$extract = trim_characters($extract, $startpos, $length_of_extract);
// Highlight search words
$extract = $SEARCHENGINE->highlight($extract);
$itemdata['body'] = $extract;
//////////////////////////
// 2. Create the URL to link to this bit of text.
$id_data = array('major' => $itemdata['major'], 'htype' => $itemdata['htype'], 'gid' => $itemdata['gid'], 'section_id' => $itemdata['section_id'], 'subsection_id' => $itemdata['subsection_id']);
// We append the query onto the end of the URL as variable 's'
// so we can highlight them on the debate/wrans list page.
$url_args = array('s' => $searchstring);
$itemdata['listurl'] = $this->_get_listurl($id_data, $url_args, $encode);
//////////////////////////
// 3. Get the speaker for this item, if applicable.
if ($itemdata['speaker_id'] != 0) {
$itemdata['speaker'] = $this->_get_speaker($itemdata['speaker_id'], $itemdata['hdate']);
}
//////////////////////////
// 4. Get data about the parent (sub)section. TODO: CHECK THIS for major==4
if ($itemdata['major'] && $hansardmajors[$itemdata['major']]['type'] == 'debate') {
// Debate
if ($itemdata['htype'] != 10) {
$section = $this->_get_section($itemdata);
$itemdata['parent']['body'] = $section['body'];
# $itemdata['parent']['listurl'] = $section['listurl'];
if ($itemdata['section_id'] != $itemdata['subsection_id']) {
$subsection = $this->_get_subsection($itemdata);
$itemdata['parent']['body'] .= ': ' . $subsection['body'];
# $itemdata['parent']['listurl'] = $subsection['listurl'];
}
if ($itemdata['major'] == 5) {
$itemdata['parent']['body'] = 'NIA: ' . $itemdata['parent']['body'];
}
} else {
// It's a section, so it will be its own title.
$itemdata['parent']['body'] = $itemdata['body'];
$itemdata['body'] = '';
}
} else {
// Wrans or WMS
$section = $this->_get_section($itemdata);
$subsection = $this->_get_subsection($itemdata);
$body = $hansardmajors[$itemdata['major']]['title'] . ' — ';
if (isset($section['body'])) {
$body .= $section['body'];
}
if (isset($subsection['body'])) {
$body .= ': ' . $subsection['body'];
}
if (isset($subsection['listurl'])) {
$listurl = $subsection['listurl'];
} else {
$listurl = '';
}
$itemdata['parent'] = array('body' => $body, 'listurl' => $listurl);
}
// Add this item's data onto the main array we'll be returning.
$rows[] = $itemdata;
}
$data['rows'] = $rows;
return $data;
}
示例4: foreach
}
?>
</rdf:Seq>
</items>
</channel>
<?php
$c = 0;
foreach ($all_news as $id => $news_row) {
if ($c++ == 10) {
break;
}
list($title, $content, $date) = $news_row;
$url = "http://www.theyworkforyou.com" . news_individual_link($date, $title);
$excerpt = trim_characters(news_format_body($content), 0, 250);
$date = str_replace(" ", "T", $date) . "+00:00";
?>
<item rdf:about="<?php
echo $url;
?>
">
<title><?php
echo htmlspecialchars($title);
?>
</title>
<link><?php
echo $url;
?>
</link>
<description><?php
示例5: format_date
echo $count;
?>
"></a><strong><a href="<?php
echo $wran['list_url'];
?>
"><?php
echo $wran['parent']['body'] . ': ' . $wran['body'];
?>
</a></strong> <?php
echo format_date($wran['hdate'], LONGDATEFORMAT) . ' ' . $totalcomments;
?>
</dt>
<dd><?php
if (sizeof($speaker)) {
?>
<a href="<?php
echo $speaker['url'];
?>
"><?php
echo member_full_name($speaker['house'], $speaker['title'], $speaker['first_name'], $speaker['last_name'], $speaker['constituency']);
?>
</a>: <?php
}
echo trim_characters($wran['child']['body'], 0, 200);
?>
</dd>
<?php
}
?>
</dl>
示例6: display
//.........这里部分代码省略.........
$form->addRule('sequence', 'Rule position must be numeric', 'numeric', null, 'server');
$form->addGroup($titlegroup, "titlegroup", "Title of rule:", null, false);
$limitgroup = array();
$limitgroup[] = &HTML_QuickForm::createElement('text', 'requests', null, array('size' => 5, 'maxlength' => 10));
$limitgroup[] = &HTML_QuickForm::createElement('static', null, null, "<b> hits every </b>");
$limitgroup[] = &HTML_QuickForm::createElement('text', 'interval', null, array('size' => 5, 'maxlength' => 10));
$limitgroup[] = &HTML_QuickForm::createElement('static', null, null, "<b> seconds</b>. Leave blank/zero to block completely.");
$form->addGroup($limitgroup, "limitgroup", "Limit rate to:", null, false);
$form->addElement('textarea', 'message', "Action when rule fires:<br>(for help see below)", array('rows' => 3, 'cols' => 60));
$form->addRule('requests', 'Hit count must be numeric', 'numeric', null, 'server');
$form->addRule('interval', 'Time period must be numeric', 'numeric', null, 'server');
$form->addRule('note', 'Description is required', 'required', null, 'server');
$form->addRule('requests', 'Requests is required', 'required', null, 'server');
$form->addRule('interval', 'Interval is required', 'required', null, 'server');
$form->addElement('header', '', 'Conditions for Rule');
// Get list of fields from ratty
$fieldarray = ratty_admin_available_fields($this->scope);
sort($fieldarray);
$fields = array();
foreach ($fieldarray as $row) {
list($field_name, $field_description, $field_examples) = $row;
$fields[$field_name] = $field_name;
if (count($field_examples) > 0) {
// Get field as an example
$example = $field_examples[0];
// Search for one that isn't empty
if (!$example and count($field_examples) > 1) {
$example = $field_examples[1];
}
$fields[$field_name] .= " (e.g. " . trim_characters($example, 0, 20) . ")";
}
}
// Grouped elements
$ix = 0;
foreach ($conditiondata as $condition) {
$ix++;
$condgroup = array();
$condgroup[0] = &HTML_QuickForm::createElement('select', "field$ix", null, $fields);
if ($condition['condition'] == 'S') {
$condgroup[1] = &HTML_QuickForm::createElement('hidden', "condition$ix", 'S');
$desc = 'Limit hits separately for each:';
} else if ($condition['condition'] == 'D') {
$condgroup[1] = &HTML_QuickForm::createElement('hidden', "condition$ix", 'D');
$desc = 'Limit number of distinct values of:';
} else {
$condgroup[1] = &HTML_QuickForm::createElement('select', "condition$ix", null,
array(
'+E' => 'exactly equals',
'-E' => 'does not equal',
'+R' => 'matches regexp',
'-R' => 'does not match regexp',
'+T' => 'roughly matches text',
'-T' => 'does not roughly match text',
'+I' => 'matches IP mask',
'-I' => 'does not match IP mask',
'+>' => 'is greater than',
'+<' => 'is smaller than',
'+P' => 'is present',
'-P' => 'is not present',
)
示例7: generate_commentteaser
function generate_commentteaser (&$row, $major, $action_links) {
// Returns HTML for the one fragment of comment and link for the sidebar.
// $totalcomments is the number of comments this item has on it.
// $comment is an array like:
/* $comment = array (
'comment_id' => 23,
'user_id' => 34,
'body' => 'Blah blah...',
'posted' => '2004-02-24 23:45:30',
'username' => 'phil'
)
*/
// $url is the URL of the item's page, which contains comments.
global $this_page, $THEUSER, $hansardmajors;
$html = '';
//Action links
if (isset($action_links)) {
$html .= '<ul>';
foreach ($action_links as $action_link) {
if (!is_array($action_link)) {
$html .= $action_link;
continue;
}
$html .= '<li>';
$html .= '<a href="' . $action_link['link'] . '" class="' . $action_link['class'] . '"';
if (isset($action_link['title'])) {
$html .= ' title="' . $action_link['title'] . '"';
}
if (isset($action_link['onclick'])) {
$html .= ' onclick="' . $action_link['onclick'] . '"';
}
$html .= '>';
$html .= $action_link["text"];
$html .= '</a>';
if (isset($action_link['after']) && $action_link['after']) {
$html .= ' (' . $action_link['after'] . ')';
}
$html .= "</li>\n";
}
$html .= '</ul>';
}
if ($hansardmajors[$major]['type'] == 'debate' && $hansardmajors[$major]['page_all']==$this_page) {
// $html .= ' <a href="' . $row['commentsurl'] . '" title="Copy this URL to link directly to this piece of text" class="permalink">Link to this</a>';
// Build the 'Add an annotation' link.
if (!$THEUSER->isloggedin()) {
$URL = new URL('userprompt');
$URL->insert(array('ret'=>$row['commentsurl']));
$commentsurl = $URL->generate();
} else {
$commentsurl = $row['commentsurl'];
}
$html .= '<div class="add"><a class="annotate" href="' . $commentsurl . '#addcomment" title="Annotate this speech">Add an annotation</a> <small>(e.g. more info, blog post or wikipedia article)</small></div>';
//Add existing annotations
if ($row['totalcomments'] > 0) {
$comment = $row['comment'];
// If the comment is longer than the speech body, we want to trim it
// to be the same length so they fit next to each other.
// But the comment typeface is smaller, so we scale things slightly too...
$targetsize = round(strlen($row['body']) * 0.6);
if ($targetsize > strlen($comment['body'])) {
// This comment will fit in its entirety.
$commentbody = $comment['body'];
if ($row['totalcomments'] > 1) {
$morecount = $row['totalcomments'] - 1;
$plural = $morecount == 1 ? 'annotation' : 'annotations';
$linktext = "Read $morecount more $plural";
}
} else {
// This comment needs trimming.
$commentbody = trim_characters($comment['body'], 0, $targetsize, 1000);
if ($row['totalcomments'] > 1) {
$morecount = $row['totalcomments'] - 1;
$plural = $morecount == 1 ? 'annotation' : 'annotations';
$linktext = "Continue reading (and $morecount more $plural)";
} else {
$linktext = 'Continue reading';
}
}
$html .= '<blockquote><p>' . prepare_comment_for_display($commentbody) . '</p><cite>Submitted by ' . htmlentities($comment['username']) . '</cite></small></blockquote>' ;
if (isset($linktext)) {
$html .= ' <a class="morecomments" href="' . $row['commentsurl'] . '#c' . $comment['comment_id'] . '" title="See any annotations posted about this">' . $linktext . '</a>';
}
}
//.........这里部分代码省略.........
示例8: URL
if (isset($data['full_name'])) {
$title .= ' on things by ' . $data['full_name'];
}
$PAGE->block_start(array('id' => 'recentcomments', 'title' => $title));
if ($this_page != 'home') {
$PAGE->page_links($data);
}
$USERURL = new URL('userview');
?>
<ul>
<?php
foreach ($data['comments'] as $n => $comment) {
?>
<li><?php
$commenttext = trim_characters($comment['body'], 0, 200, 40);
list($date, $time) = explode(' ', $comment['posted']);
$date = format_date($date, SHORTDATEFORMAT);
$time = format_time($time, TIMEFORMAT);
$count = $n + 1;
$USERURL->insert(array('u' => $comment['user_id']));
?>
<a name="c<?php
echo $count;
?>
"></a><strong><?php
echo _htmlentities($comment['firstname'] . ' ' . $comment['lastname']);
?>
:</strong> <?php
echo $commenttext;
?>
示例9: output
/**
* Output Page
*
* Assembles a completed page from template and sends it to output.
*
* @param string $template The name of the template file to load.
* @param array $data An associative array of data to be made available to the template.
*/
public static function output($template, $data = array())
{
// Include includes.
// TODO: Wrap these in a class somewhere autoloadable.
include_once INCLUDESPATH . 'postcode.inc';
////////////////////////////////////////////////////////////
// Find the user's country. Used by header, so a safe bit to do regardless.
if (preg_match('#^[A-Z]{2}$#i', get_http_var('country'))) {
$data['country'] = strtoupper(get_http_var('country'));
} else {
$data['country'] = Gaze::get_country_by_ip($_SERVER["REMOTE_ADDR"]);
}
////////////////////////////////////////////////////////////
// Get the page data
global $DATA, $this_page, $THEUSER;
////////////////////////////////////////////////////////////
// Assemble the page title
$data['page_title'] = '';
$sitetitle = $DATA->page_metadata($this_page, "sitetitle");
$keywords_title = '';
if ($this_page == 'overview') {
$data['page_title'] = $sitetitle . ': ' . $DATA->page_metadata($this_page, "title");
} else {
if ($page_title = $DATA->page_metadata($this_page, "title")) {
$data['page_title'] = $page_title;
}
// We'll put this in the meta keywords tag.
$keywords_title = $data['page_title'];
$parent_page = $DATA->page_metadata($this_page, 'parent');
if ($parent_title = $DATA->page_metadata($parent_page, 'title')) {
if ($data['page_title']) {
$data['page_title'] .= ': ';
}
$data['page_title'] .= $parent_title;
}
if ($data['page_title'] == '') {
$data['page_title'] = $sitetitle;
} else {
$data['page_title'] .= ' - ' . $sitetitle;
}
}
////////////////////////////////////////////////////////////
// Meta keywords
if (!($data['meta_keywords'] = $DATA->page_metadata($this_page, "meta_keywords"))) {
$data['meta_keywords'] = $keywords_title;
if ($data['meta_keywords']) {
$data['meta_keywords'] .= ', ';
}
$data['meta_keywords'] .= 'Hansard, Official Report, Parliament, government, House of Commons, House of Lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, Scottish Parliament, Northern Ireland Assembly, MSP, MLA, MSPs, MLAs';
}
$data['meta_description'] = '';
if ($DATA->page_metadata($this_page, "meta_description")) {
$data['meta_description'] = $DATA->page_metadata($this_page, "meta_description");
}
////////////////////////////////////////////////////////////
// Header <link>s
$data['header_links'] = array();
if ($this_page != 'overview') {
$URL = new \URL('overview');
$data['header_links'][] = array('rel' => 'start', 'title' => 'Home', 'href' => $URL->generate());
}
////////////////////////////////////////////////////////////
// Create the next/prev/up links for navigation.
// Their data is put in the metadata in hansardlist.php
$nextprev = $DATA->page_metadata($this_page, "nextprev");
if ($nextprev) {
// Four different kinds of back/forth links we might build.
$links = array("first", "prev", "up", "next", "last");
foreach ($links as $type) {
if (isset($nextprev[$type]) && isset($nextprev[$type]['url'])) {
if (isset($nextprev[$type]['body'])) {
$linktitle = _htmlentities(trim_characters($nextprev[$type]['body'], 0, 40));
if (isset($nextprev[$type]['speaker']) && count($nextprev[$type]['speaker']) > 0) {
$linktitle = $nextprev[$type]['speaker']['name'] . ': ' . $linktitle;
}
} elseif (isset($nextprev[$type]['hdate'])) {
$linktitle = format_date($nextprev[$type]['hdate'], SHORTDATEFORMAT);
}
$data['header_links'][] = array('rel' => $type, 'title' => $linktitle, 'href' => $nextprev[$type]['url']);
}
}
}
////////////////////////////////////////////////////////////
// Page RSS URL
if ($DATA->page_metadata($this_page, 'rss')) {
// If this page has an RSS feed set.
$data['page_rss_url'] = 'http://' . DOMAIN . WEBPATH . $DATA->page_metadata($this_page, 'rss');
}
////////////////////////////////////////////////////////////
// Site Navigation Links
$data['assembly_nav_links'] = array();
$data['section_nav_links'] = array();
//.........这里部分代码省略.........
示例10: twfy_debug
// For displaying recent Hansard items for MPs.
// Remember, we are currently within the HANSARDLIST, DEBATELIST or WRANSLISTS class,
// in the render() function.
// The array $data will be packed full of luverly stuff about hansard objects.
// See the bottom of hansard_gid for information about its structure and contents...
global $PAGE, $hansardmajors;
twfy_debug("TEMPLATE", "hansard_person.php");
if (isset($data['rows']) && count($data['rows']) > 0) {
foreach ($data['rows'] as $n => $row) {
// While we're linking to individual speeches,
// the text is the body of the parent, ie (sub)section.
$text = $row['parent']['body'];
if (isset($row['listurl'])) {
// So we can link to the 'More recent appearances' precisely.
$count = $n + 1;
$text = "<a name=\"n{$count}\"></a><strong><a href=\"" . $row['listurl'] . "\">{$text}</a></strong> ";
}
$text .= '<small>' . format_date($row['hdate'], SHORTDATEFORMAT);
if ($hansardmajors[$row['major']]['type'] == 'debate') {
$plural = $row['total_speeches'] == 1 ? 'speech' : 'speeches';
$text .= ' (' . $row['total_speeches'] . " {$plural})";
}
$text .= '</small>';
$text = "\t\t\t\t<p>{$text}<br />\n\t\t\t\t“" . trim_characters($row['body'], 0, 200) . "”</p>\n";
print $text;
}
} else {
?>
<p>No data to display.</p>
<?php
}
示例11: array
<?php
include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH . "easyparliament/searchlog.php";
$this_page = "admin_searchlogs";
$PAGE->page_start();
$PAGE->stripe_start();
global $SEARCHLOG;
$search_recent = $SEARCHLOG->admin_recent_searches(50);
$rows = array();
foreach ($search_recent as $row) {
$host = gethostbyaddr($row['ip_address']);
$host = trim_characters($host, strlen($host) - 25, 100);
$time = relative_time($row['query_time']);
$time = str_replace(" ago", "", $time);
$rows[] = array('<a href="' . $row['url'] . '">' . htmlentities($row['query']) . '</a>', $row['page_number'], $row['count_hits'], $host, $time);
}
$tabledata = array('header' => array('Query', 'Page', 'Hits', 'Host', 'Time ago'), 'rows' => $rows);
$PAGE->display_table($tabledata);
$menu = $PAGE->admin_menu();
$PAGE->stripe_end(array(array('type' => 'html', 'content' => $menu)));
$PAGE->page_end();
示例12: strip_tags
<?php
if (isset($item['child'])) {
?>
<p class="business-list__excerpt">
<?php
if (isset($item['child']['speaker']) && count($item['child']['speaker']) > 0) {
?>
<a href="<?php
echo $item['child']['speaker']['url'];
?>
"><?php
echo $item['child']['speaker']['name'];
?>
</a>
<?php
}
?>
<?php
echo strip_tags(trim_characters($item['child']['body'], 0, 200));
?>
</p>
<?php
}
?>
</li>
<?php
}
?>
</ul>
</div>
示例13: add
public function add($trackbackdata)
{
/*
$data = array (
'epobject_id' => '34533',
'url' => 'http://www.gyford.com/weblog/my_entry.html',
'blog_name' => "Phil's weblog",
'title' => 'Interesting speech',
'excerpt' => 'My MP has posted an interesting speech, etc',
'source_ip' => '123.123.123.123'
);
*/
// This code originally based on stuff from http://wordpress.org/
if ($this->trackbacks_enabled() == false) {
$this->_trackback_response(1, 'Sorry, trackbacks are disabled.');
}
$epobject_id = $trackbackdata['epobject_id'];
// Check this epobject_id exists.
$q = $this->db->query("SELECT epobject_id\n FROM\tepobject\n WHERE\tepobject_id = '" . addslashes($epobject_id) . "'");
if ($q->rows() == 0) {
$this->_trackback_response(1, "Sorry, we don't have a valid epobject_id.");
}
// Still here? Then we're trackbacking to a valid hansard item.
$url = $trackbackdata['url'];
$source_ip = $trackbackdata['source_ip'];
// These all strip_tags too.
$title = trim_characters(html_entity_decode($trackbackdata['title']), 0, 255);
$excerpt = trim_characters(html_entity_decode($trackbackdata['excerpt']), 0, 255);
$blog_name = trim_characters(html_entity_decode($trackbackdata['blog_name']), 0, 255);
$visible = $this->moderate_trackbacks ? 0 : 1;
$q = $this->db->query("INSERT INTO trackbacks\n (epobject_id, blog_name, title, excerpt, url, source_ip, posted, visible)\n VALUES\n ('" . addslashes($epobject_id) . "',\n '" . addslashes($blog_name) . "',\n '" . addslashes($title) . "',\n '" . addslashes($excerpt) . "',\n '" . addslashes($url) . "',\n '" . addslashes($source_ip) . "',\n NOW(),\n '{$visible}')\n ");
if ($q->success()) {
// Return a success message.
$this->_trackback_response(0);
} else {
die("Sorry, we could not save the trackback to the database. Please <a href=\"mailto:" . CONTACTEMAIL . "\">email us</a> to let us know. Thanks.");
}
}
示例14: get_post_meta
if (get_post_meta($post->ID, '_cmb_event_time', true) != '') {
?>
<span class="time"><i class="fa fa-clock-o"></i><?php
echo get_post_meta($post->ID, '_cmb_event_time', true);
?>
</span>
</div>
<?php
}
?>
<?php
if (has_excerpt()) {
the_excerpt();
} else {
echo '<p>' . trim_characters(get_the_content()) . '</p>';
}
?>
<a href="<?php
echo get_permalink();
?>
" class="learn-more"><?php
_e('Learn More', 'ta-music');
?>
</a>
</div><!-- .event -->
<?php
}
// end of the loop
wp_reset_postdata();
}
示例15: display_commentreportlist
function display_commentreportlist($data)
{
// For the admin section.
// Gets an array of data from COMMENTLIST->render().
// Passes it on to $this->display_table().
if (count($data) > 0) {
?>
<h3>Reported comments</h3>
<?php
// Put the data in an array which we then display using $PAGE->display_table().
$tabledata['header'] = array('Reported by', 'Begins...', 'Reported on', '');
$tabledata['rows'] = array();
$EDITURL = new URL('admin_commentreport');
foreach ($data as $n => $report) {
if (!$report['locked']) {
// Yes, we could probably cope if we just passed the report_id
// through, but this isn't a public-facing page and life's
// easier if we have the comment_id too.
$EDITURL->insert(array('rid' => $report['report_id'], 'cid' => $report['comment_id']));
$editlink = '<a href="' . $EDITURL->generate() . '">View</a>';
} else {
$editlink = 'Locked';
}
$body = trim_characters($report['body'], 0, 40);
$tabledata['rows'][] = array(htmlentities($report['firstname'] . ' ' . $report['lastname']), htmlentities($body), $report['reported'], $editlink);
}
$this->display_table($tabledata);
} else {
print "<p>There are no outstanding comment reports.</p>\n";
}
}