本文整理汇总了PHP中auto_link_text函数的典型用法代码示例。如果您正苦于以下问题:PHP auto_link_text函数的具体用法?PHP auto_link_text怎么用?PHP auto_link_text使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auto_link_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parsetext
function parsetext($text)
{
$res = $text;
// убираем переводы строк внутри тэгов
do {
$oldRes = $res;
$res = preg_replace("/(<[^>]*)[\n\r]/m", '$1 ', $res);
} while ($res != $oldRes);
$res = auto_link_text($res);
$res = strip_tags_attributes($res, array('<strike>', '<s>', '<sup>', '<sub>', '<embed>', '<object>', '<param>', '<p>', '<b>', '<i>', '<br>', '<br/>', '<a>', '<em>', '<font>', '<strong>', '<img>', '<img/>', '<small>', '<big>', '<div>', '<span>'));
$res = closetags($res);
$res = redirectExternalLinks($res);
$res = nl2br($res);
$res = str_replace(array("\n", "\r"), " ", $res);
$res = trim($res);
return $res;
}
示例2: replaceTextToLinks
function replaceTextToLinks($text)
{
preg_match_all('|<pre>(.*)<\\/pre>|U', $text, $matches);
$pre = array();
foreach ($matches[0] as $v) {
$code_id = '<code' . mt_rand() . '>';
$pre[$code_id] = $v;
$text = str_replace($v, $code_id, $text);
}
$text = str_replace('<a href', '<a target="_balnk" href', $text);
$text = auto_link_text($text, 'urls', array('target' => '_blank'), true, 85);
$text = preg_replace_callback('/<a(.*)>(.*)<\\/a>/', 'truncateLongLinks', $text);
$text = preg_replace_callback('/<script(.*)>(.*)<\\/script>/si', 'convertJavascriptSpceialCharacters', $text);
foreach ($pre as $code_id => $v) {
$v = str_replace('<pre>', '<pre class="code" id="' . str_replace(array('<', '>'), '', $code_id) . '">', $v);
$text = str_replace($code_id, $v, $text);
}
return $text;
}
示例3: update_supplier
/**
*
* @return mixed s_id on success, false on failure
*/
public function update_supplier($s_id)
{
//parse for urls
$this->load->helper('text_helper');
$description = auto_link_text($this->input->post('s_description'));
if ($s_id) {
$sql = 'UPDATE
supplier
SET
s_name = ?,
s_description = ?
WHERE
s_id = ?';
$sql_data = array($this->input->post('s_name'), $description, $s_id);
} else {
$sql = 'INSERT
INTO
supplier
(s_name, s_description)
VALUES
(?, ?)';
$sql_data = array($this->input->post('s_name'), $description);
}
//run query
$result = $this->db->query($sql, $sql_data);
//all done
if ($result && $s_id) {
return $s_id;
} else {
if ($result) {
return $this->db->insert_id();
} else {
return false;
}
}
}
示例4: user_pic
<table style="border-bottom: 1px dotted #EEEEEE;">
<tr>
<td style="padding: 0.5em; width: 40px;">
<?php
echo user_pic($top_analyst, 'profile', array('width' => 40));
?>
</td>
<td style="padding: 0.5em;">
<span class="text_big"><?php
echo user_link($top_analyst);
?>
</span>
<br />
<span style="color: #666;"><?php
echo $top_analyst->group_score;
?>
points</span>
</td>
</tr>
</table>
<?php
}
?>
<?php
end_slot();
?>
<?php
echo auto_link_text(html_entity_decode($group->contest));
示例5: date
</a>
<?php
} else {
?>
<?php
echo $feedItem->getTitle();
?>
<?php
}
?>
</li>
<?php
$date = $feedItem->getPubDate();
?>
<?php
if ($date) {
?>
<li class="date"><?php
echo $dateFormat ? date($dateFormat, $date) : aDate::pretty($date) . ' ' . aDate::time($date);
?>
</li>
<?php
}
?>
<li class="description"><?php
echo auto_link_text(aHtml::simplify($feedItem->getDescription(), $markup, false, isset($attributes) ? $attributes : false, isset($styles) ? $styles : false));
?>
</li>
</ul>
</li>
示例6: preg_replace_callback
');
return preg_replace_callback($pattern, $callback, $text);
}
$followers = $connection->get("https://api.twitter.com/1.1/followers/list.json?cursor=-1&screen_name=" . $twitteruser . "&count=48");
$followersHTML = '';
$tweetsHTML = '';
if (isset($followers->errors)) {
echo "<div style='background: white;'>Please configure this module using CometChat Administration Panel.</div>";
exit;
} else {
foreach ($followers->users as $follower) {
$followersHTML .= '<a target="_blank" href="http://www.twitter.com/' . $follower->screen_name . '"><img width=24 height=24 src="' . str_replace('normal', 'mini', $follower->profile_image_url) . '" alt="' . $follower->name . '" title="' . $follower->name . '"></a>';
}
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $twitteruser . "&count=" . $notweets);
foreach ($tweets as $tweet) {
$tweetsHTML .= '<li class="tweet">' . auto_link_text($tweet->text) . '<br /><small class="chattime" timestamp="' . strtotime($tweet->created_at) . '"></small></li>';
}
}
$extrajs = '';
if ($sleekScroller == 1) {
$extrajs = '<script>jqcc=jQuery;</script><script src="../../js.php?type=core&name=scroll"></script>';
}
echo <<<EOD
<!DOCTYPE html>
<html>
\t<head>
\t\t<meta http-equiv="cache-control" content="no-cache">
\t\t<meta http-equiv="pragma" content="no-cache">
\t\t<meta http-equiv="expires" content="-1">
\t\t<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
\t\t<link type="text/css" rel="stylesheet" media="all" href="../../css.php?type=module&name=twitter" />
示例7: foreach
.appendTo('#video-<?php
echo $testcase->getClassName();
?>
');
}
});
<?php
// Add assertions, failures and errors to stacktrace
$stacktrace = 'Assertions: ' . $testcase->getNumberOfAssertions() . ' Failures: ' . $testcase->getNumberOfFailure() . ' Errors: ' . $testcase->getNumberOfErrors();
foreach ($testcase->getErrors() as $error) {
$stackstring = htmlify($error->getContent());
$stacktrace = $stacktrace . '<br/>####################################################<br/>## <b>ERROR:</b> ' . $error->getType() . '<br/>####################################################<br/>' . auto_link_text($stackstring);
}
foreach ($testcase->getFailures() as $failure) {
$stackstring = htmlify($failure->getContent());
$stacktrace = $stacktrace . '<br/>####################################################<br/>## <b>FAILURE:</b> ' . $failure->getType() . '<br/>####################################################<br/>' . auto_link_text($stackstring);
}
// Generate line numbers to use next to source code for easy to find failures and errors
$linenumbers = '';
for ($i = 1; $i <= $testcase->getSourcecodeNumberOfLines(); $i++) {
// Color red if there is an error on this line
$screenshot = $testcase->getScreenshotOnLine($i);
if ($testcase->lineHasError($i)) {
$linenumbers .= '<font style="BACKGROUND-COLOR: red" color="white">';
if ($screenshot) {
$linenumbers .= '<a class="single_image" rel="group-' . $testcase->getClassName() . '" href="' . $result->getTestsDirectoryRelative() . $screenshot . '">';
}
$linenumbers .= $i;
if ($screenshot) {
$linenumbers .= '</a>';
}
示例8: use_helper
<?php
use_helper('Text', 'Date');
?>
<ul class="board_news">
<?php
foreach ($arrFeeds as $item) {
?>
<li><?php
echo auto_link_text($item['title'], 'all', array('target' => '_blank'));
?>
<div class="news_info">
<span class="date"><?php
echo format_datetime($item['date'], 'f');
?>
</span>
:: <span class="link"><a href="<?php
echo $item['link'];
?>
" target="_blank"><?php
echo __('More');
?>
</a></span>
</div>
</li>
<?php
}
?>
</ul>
示例9: use_helper
<?php
use_helper('Text');
?>
<?php
slot('header_text', $group['display_name']);
slot('header_link', sfGuardGroupTable::getInternalUrl($group));
slot("header_subtext", auto_link_text(html_entity_decode($group->blurb)));
?>
<?php
if ($sf_user->isAuthenticated()) {
if (!isset($hide_actions) || !$hide_actions) {
?>
<?php
slot('header_actions', array('edit' => array('url' => $group->getInternalUrl('edit'), 'condition' => $sf_user->hasCredential('admin') || $sf_user->getGuardUser()->isGroupOwner($group->name)), 'leave group' => array('url' => $group->getInternalUrl('leave'), 'condition' => $sf_user->hasGroup($group->name), 'options' => 'post=true confirm=Are you sure you want to leave this group?'), 'join group' => array('url' => $group->getInternalUrl('join'), 'condition' => !$sf_user->hasGroup($group->name), 'options' => 'post=true')));
}
}
示例10: __
?>
<h2><?php
echo __('Contacts');
?>
:</h2>
<p>
<dl>
<?php
foreach ($coms as $com) {
?>
<dt><?php
echo $com->getCommType();
?>
<dt>
<dd><?php
echo auto_link_text($com->getEntry());
?>
</dd>
<?php
}
?>
</dl>
</p>
<?php
}
?>
<?php
if (isset($staff) && $staff) {
?>
<h2><?php
示例11: use_helper
<?php
use_helper('Text');
foreach ($Comments as $comment) {
?>
<fieldset class="opened view_mode"><legend class="view_mode"><b><?php
echo __('Notion');
?>
</b> : <?php
echo __($comment->getNotionText());
?>
</legend>
<?php
echo auto_link_text(nl2br($comment->getComment()));
?>
</fieldset>
<?php
}
?>
示例12: strpos
$vPos = strpos($source, "vine");
$type = 'twitter';
$typePretty = 'Twitter';
$urls = $item->entities->urls;
$defaultImage = 'img/default_twitter.png';
$icon = NULL;
foreach ($urls as $url) {
if (strpos($url->expanded_url, 'vine') !== false) {
$profileUrl = NULL;
$icon = 'img/icon_vine.png';
$defaultImage = 'img/default_vine.png';
$typePretty = 'Vine';
$type = 'vine';
$link = $url->expanded_url;
continue;
}
}
if (isset($item->retweeted_status)) {
$rtUser = $item->retweeted_status->user->screen_name;
$title = 'RT @' . $rtUser . ': ' . auto_link_text($item->retweeted_status->text);
} else {
$title = auto_link_text($item->text);
}
$node = array('id' => $item->id, 'title' => $title, 'image' => $defaultImage, 'copy' => NULL, 'link_copy' => 'View video', 'link' => $link, 'type_pretty' => $typePretty, 'type' => $type, 'icon' => $icon, 'meta' => NULL, 'feed' => NULL, 'epoch' => strtotime($item->created_at), 'profile_url' => $profileUrl);
array_push($data, $node);
}
if (isset($_GET['raw']) && $_GET['raw'] == '1') {
echo json_encode($info);
} else {
echo json_encode($data);
}
示例13: array
$t->is(simple_format_text("1\n2\n3"), "<p>1\n<br />2\n<br />3</p>", 'text_simple_format() Ticket #6824');
// text_strip_links()
$t->diag('text_strip_links()');
$t->is(strip_links_text("<a href='almost'>on my mind</a>"), "on my mind", 'text_strip_links() strips all links in input');
$t->is(strip_links_text('<a href="first.html">first</a> and <a href="second.html">second</a>'), "first and second", 'text_strip_links() strips all links in input');
// auto_link_text()
$t->diag('auto_link_text()');
$email_raw = 'fabien.potencier@symfony-project.com';
$email_result = '<a href="mailto:' . $email_raw . '">' . $email_raw . '</a>';
$link_raw = 'http://www.google.com';
$link_result = '<a href="' . $link_raw . '">' . $link_raw . '</a>';
$link2_raw = 'www.google.com';
$link2_result = '<a href="http://' . $link2_raw . '">' . $link2_raw . '</a>';
$t->is(auto_link_text('hello ' . $email_raw, 'email_addresses'), 'hello ' . $email_result, 'auto_link_text() converts emails to links');
$t->is(auto_link_text('Go to ' . $link_raw, 'urls'), 'Go to ' . $link_result, 'auto_link_text() converts absolute URLs to links');
$t->is(auto_link_text('Go to ' . $link_raw, 'email_addresses'), 'Go to ' . $link_raw, 'auto_link_text() takes a second parameter');
$t->is(auto_link_text('Go to ' . $link_raw . ' and say hello to ' . $email_raw), 'Go to ' . $link_result . ' and say hello to ' . $email_result, 'auto_link_text() converts emails and URLs if no second argument is given');
$t->is(auto_link_text('<p>Link ' . $link_raw . '</p>'), '<p>Link ' . $link_result . '</p>', 'auto_link_text() converts URLs to links');
$t->is(auto_link_text('<p>' . $link_raw . ' Link</p>'), '<p>' . $link_result . ' Link</p>', 'auto_link_text() converts URLs to links');
$t->is(auto_link_text('Go to ' . $link2_raw, 'urls'), 'Go to ' . $link2_result, 'auto_link_text() converts URLs to links even if link does not start with http://');
$t->is(auto_link_text('Go to ' . $link2_raw, 'email_addresses'), 'Go to ' . $link2_raw, 'auto_link_text() converts URLs to links');
$t->is(auto_link_text('<p>Link ' . $link2_raw . '</p>'), '<p>Link ' . $link2_result . '</p>', 'auto_link_text() converts URLs to links');
$t->is(auto_link_text('<p>' . $link2_raw . ' Link</p>'), '<p>' . $link2_result . ' Link</p>', 'auto_link_text() converts URLs to links');
$t->is(auto_link_text('<p>http://www.google.com/?q=symfony Link</p>'), '<p><a href="http://www.google.com/?q=symfony">http://www.google.com/?q=symfony</a> Link</p>', 'auto_link_text() converts URLs to links');
$t->is(auto_link_text('<p>http://www.google.com/?q=symfony+link</p>', 'all', array(), true), '<p><a href="http://www.google.com/?q=symfony+link">http://www.google.com/?q=symfony+li...</a></p>', 'auto_link_text() truncates URLs in links');
$t->is(auto_link_text('<p>http://www.google.com/?q=symfony+link</p>', 'all', array(), true, 32, '***'), '<p><a href="http://www.google.com/?q=symfony+link">http://www.google.com/?q=symfony***</a></p>', 'auto_link_text() takes truncation parameters');
$t->is(auto_link_text('<p>http://twitter.com/#!/fabpot</p>'), '<p><a href="http://twitter.com/#!/fabpot">http://twitter.com/#!/fabpot</a></p>', "auto_link_text() converts URLs with complex fragments to links");
$t->is(auto_link_text('<p>http://twitter.com/#!/fabpot is Fabien Potencier on Twitter</p>'), '<p><a href="http://twitter.com/#!/fabpot">http://twitter.com/#!/fabpot</a> is Fabien Potencier on Twitter</p>', "auto_link_text() converts URLs with complex fragments and trailing text to links");
$t->is(auto_link_text('hello ' . $email_result, 'email_addresses'), 'hello ' . $email_result, "auto_link_text() does not double-link emails");
$t->is(auto_link_text('<p>Link ' . $link_result . '</p>'), '<p>Link ' . $link_result . '</p>', "auto_link_text() does not double-link emails");
示例14: image_tag_sf_image
?>
" target="_blank">
<?php
echo image_tag_sf_image($image->getFile(), array('size' => '120x120'));
?>
</a></li>
<?php
}
?>
</ul>
<?php
}
?>
<p class="text">
<?php
echo auto_link_text(nl2br($message->getDecoratedMessageBody()), 'urls', array('target' => '_blank'), true, 57);
?>
</p>
</div>
<?php
/* @todo 添付ファイル
({if $c_message.filename && $smarty.const.OPENPNE_USE_FILEUPLOAD})
<div class="block attachFile"><ul>
<li><a href="({t_url m=pc a=do_h_message_file_download})&target_c_message_id=({$c_message.c_message_id})&sessid=({$PHPSESSID})">({$c_message.original_filename})</a></li>
</ul></div>
({/if})
*/
?>
<div class="operation">
<ul class="moreInfo button">
示例15: testdescriptionTxtFile
function testdescriptionTxtFile($filename_txt)
{
$handle = fopen($filename_txt, "r");
// HTML-ify and get testdescription
$testdescription = htmlify(fread($handle, filesize($filename_txt)));
// Replace URLs with actual links
$testdescription = auto_link_text($testdescription);
fclose($handle);
}