本文整理汇总了PHP中br2nl函数的典型用法代码示例。如果您正苦于以下问题:PHP br2nl函数的具体用法?PHP br2nl怎么用?PHP br2nl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了br2nl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBr2nl
public function testBr2nl()
{
$text = 'This<br />is some<br>text.';
$result = br2nl($text);
$expected = 'This' . PHP_EOL . 'is some' . PHP_EOL . 'text.';
$this->assertEqual($result, $expected);
}
示例2: getinfoAction
public function getinfoAction()
{
$db = front::og('db');
$one_news = $db->select('SELECT tp.*, tg.title as group_name FROM team_people tp JOIN team_groups tg on tg.id = tp.groupid WHERE tp.id = ?n LIMIT 1;', front::$_req['id'])->fetchRow();
$one_news = front::toUtf($one_news);
$one_news['additional'] = br2nl($one_news['additional']);
echo json_encode(array('form' => $one_news));
}
示例3: getinfoAction
function getinfoAction()
{
$db = front::og("db");
$one_news = $db->select("SELECT tp.*, tg.title as group_name FROM team_people tp JOIN team_groups tg on tg.id = tp.groupid WHERE tp.id = ?n LIMIT 1;", front::$_req["id"])->fetchRow();
$one_news = front::toUtf($one_news);
$one_news["additional"] = br2nl($one_news["additional"]);
echo json_encode(array("form" => $one_news));
}
示例4: edit
public function edit($pid)
{
$data['title'] = '修改页面';
if ($_POST) {
$str = array('title' => $this->input->post('title'), 'content' => nl2br($this->input->post('content')), 'go_url' => $this->input->post('go_url'), 'is_hidden' => $this->input->post('is_hidden'), 'add_time' => time());
if ($this->page_m->update_page($pid, $str)) {
show_message('修改页面成功!', site_url('admin/page'), 1);
}
}
$data['page'] = $this->page_m->get_page_content($pid);
$this->load->helper('br2nl');
$data['page']['content'] = br2nl($data['page']['content']);
$data['csrf_name'] = $this->security->get_csrf_token_name();
$data['csrf_token'] = $this->security->get_csrf_hash();
$this->load->view('page_edit', $data);
}
示例5: update_order_messages
function update_order_messages()
{
$step = 3000;
$count_messages = Db::getInstance()->getValue('SELECT count(id_message) FROM ' . _DB_PREFIX_ . 'message');
$nb_loop = $start = 0;
$pattern = '<br|&[a-zA-Z]{1,8};';
if ($count_messages > 0) {
$nb_loop = ceil($count_messages / $step);
}
for ($i = 0; $i < $nb_loop; $i++) {
$sql = 'SELECT id_message, message FROM `' . _DB_PREFIX_ . 'message` WHERE message REGEXP \'' . pSQL($pattern, true) . '\' LIMIT ' . (int) $start . ', ' . (int) $step;
$start = intval(($i + 1) * $step);
if ($messages = Db::getInstance()->query($sql)) {
while ($message = Db::getInstance()->nextRow($messages)) {
if (is_array($message)) {
Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'message`
SET message = \'' . pSQL(preg_replace('/' . $pattern . '/', '', Tools::htmlentitiesDecodeUTF8(br2nl($message['message'])))) . '\'
WHERE id_message = ' . (int) $message['id_message']);
}
}
}
}
$nb_loop = $start = 0;
if ($count_messages > 0) {
$nb_loop = ceil($count_messages / $step);
}
for ($i = 0; $i < $nb_loop; $i++) {
$sql = 'SELECT id_customer_message, message FROM `' . _DB_PREFIX_ . 'customer_message` WHERE message REGEXP \'' . pSQL($pattern, true) . '\' LIMIT ' . (int) $start . ', ' . (int) $step;
$start = intval(($i + 1) * $step);
if ($messages = Db::getInstance()->query($sql)) {
while ($message = Db::getInstance()->nextRow($messages)) {
if (is_array($message)) {
Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'customer_message`
SET message = \'' . pSQL(preg_replace('/' . $pattern . '/', '', Tools::htmlentitiesDecodeUTF8(str_replace('&', '&', $message['message'])))) . '\'
WHERE id_customer_message = ' . (int) $message['id_customer_message']);
}
}
}
}
}
示例6: update_order_messages
function update_order_messages()
{
$step = 3000;
$count_messages = Db::getInstance()->getValue('SELECT count(id_message) FROM ' . _DB_PREFIX_ . 'message');
$nb_loop = $start = 0;
if ($count_messages > 0) {
$nb_loop = ceil($count_messages / $step);
}
for ($i = 0; $i < $nb_loop; $i++) {
$sql = 'SELECT id_message, message FROM ' . _DB_PREFIX_ . 'message LIMIT ' . (int) $start . ', ' . (int) $step;
if ($messages = Db::getInstance()->executeS($sql)) {
if (is_array($messages)) {
foreach ($messages as $message) {
$sql = 'UPDATE ' . _DB_PREFIX_ . 'message SET message = \'' . pSQL(Tools::htmlentitiesDecodeUTF8(br2nl($message['message']))) . '\'
WHERE id_message = ' . (int) $message['id_message'];
$result = Db::getInstance()->execute($sql);
}
}
$start += $step + 1;
}
}
$count_messages = Db::getInstance()->getValue('SELECT count(id_customer_message) FROM ' . _DB_PREFIX_ . 'customer_message');
$nb_loop = $start = 0;
if ($count_messages > 0) {
$nb_loop = ceil($count_messages / $step);
}
for ($i = 0; $i < $nb_loop; $i++) {
$sql = 'SELECT id_customer_message, message FROM ' . _DB_PREFIX_ . 'customer_message LIMIT ' . (int) $start . ', ' . (int) $step;
if ($messages = Db::getInstance()->executeS($sql)) {
if (is_array($messages)) {
foreach ($messages as $message) {
$sql = 'UPDATE ' . _DB_PREFIX_ . 'customer_message SET message = \'' . pSQL(Tools::htmlentitiesDecodeUTF8(str_replace('&', '&', $message['message']))) . '\'
WHERE id_customer_message = ' . (int) $message['id_customer_message'];
Db::getInstance()->execute($sql);
}
}
$start += $step + 1;
}
}
}
示例7: getDefinition
public function getDefinition($term)
{
$data = array('term' => $term);
$html = libHTTP::GET('http://www.urbandictionary.com/define.php?term=' . urlencode($term));
if ($html === false) {
$data['timeout'] = true;
return $data;
}
if (strstr($html, "isn't defined.<br/>")) {
$data['undefined'] = true;
return $data;
}
preg_match('#<div class=\'meaning\'>(.+?)</div>.*?<div class=\'example\'>(.*?)</div>#s', $html, $arr);
$definition = trim(html_entity_decode(strip_tags(br2nl($arr[1]))));
$definition = strtr($definition, array("\r" => ' ', "\n" => ' '));
$definition = preg_replace_callback('/&#([a-z0-9]+);/i', create_function('$a', 'return chr(hexdec($a[0]));'), $definition);
while (false !== strstr($definition, ' ')) {
$definition = str_replace(' ', ' ', $definition);
}
if (strlen($definition) > 800) {
$definition = substr($definition, 0, 800) . '...';
}
$data['definition'] = $definition;
if (!empty($arr[2])) {
$example = trim(html_entity_decode(strip_tags(br2nl($arr[2]))));
$example = strtr($example, array("\r" => ' | ', "\n" => ' | '));
$example = preg_replace_callback('/&#([a-z0-9]+);/i', create_function('$a', 'return chr(hexdec($a[0]));'), $example);
while (false !== strstr($example, ' | | ')) {
$example = str_replace(' | | ', ' | ', $example);
}
while (false !== strstr($example, ' ')) {
$example = str_replace(' ', ' ', $example);
}
if (strlen($example) > 800) {
$example = substr($example, 0, 800) . '...';
}
$data['example'] = $example;
}
return $data;
}
示例8: customers_update
function customers_update($selected_id)
{
global $Translation;
if ($_GET['update_x'] != '') {
$_POST = $_GET;
}
// mm: can member edit record?
$arrPerm = getTablePermissions('customers');
$ownerGroupID = sqlValue("select groupID from membership_userrecords where tableName='customers' and pkValue='" . makeSafe($selected_id) . "'");
$ownerMemberID = sqlValue("select lcase(memberID) from membership_userrecords where tableName='customers' and pkValue='" . makeSafe($selected_id) . "'");
if ($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[3] == 3) {
// allow update?
// update allowed, so continue ...
} else {
return false;
}
$data['CustomerID'] = makeSafe($_POST['CustomerID']);
if ($data['CustomerID'] == empty_lookup_value) {
$data['CustomerID'] = '';
}
$data['CompanyName'] = makeSafe($_POST['CompanyName']);
if ($data['CompanyName'] == empty_lookup_value) {
$data['CompanyName'] = '';
}
$data['ContactName'] = makeSafe($_POST['ContactName']);
if ($data['ContactName'] == empty_lookup_value) {
$data['ContactName'] = '';
}
$data['ContactTitle'] = makeSafe($_POST['ContactTitle']);
if ($data['ContactTitle'] == empty_lookup_value) {
$data['ContactTitle'] = '';
}
$data['Address'] = br2nl(makeSafe($_POST['Address']));
$data['City'] = makeSafe($_POST['City']);
if ($data['City'] == empty_lookup_value) {
$data['City'] = '';
}
$data['Region'] = makeSafe($_POST['Region']);
if ($data['Region'] == empty_lookup_value) {
$data['Region'] = '';
}
$data['PostalCode'] = makeSafe($_POST['PostalCode']);
if ($data['PostalCode'] == empty_lookup_value) {
$data['PostalCode'] = '';
}
$data['Country'] = makeSafe($_POST['Country']);
if ($data['Country'] == empty_lookup_value) {
$data['Country'] = '';
}
$data['Phone'] = makeSafe($_POST['Phone']);
if ($data['Phone'] == empty_lookup_value) {
$data['Phone'] = '';
}
$data['Fax'] = makeSafe($_POST['Fax']);
if ($data['Fax'] == empty_lookup_value) {
$data['Fax'] = '';
}
$data['selectedID'] = makeSafe($selected_id);
// hook: customers_before_update
if (function_exists('customers_before_update')) {
$args = array();
if (!customers_before_update($data, getMemberInfo(), $args)) {
return false;
}
}
$o = array('silentErrors' => true);
sql('update `customers` set `CustomerID`=' . ($data['CustomerID'] !== '' && $data['CustomerID'] !== NULL ? "'{$data['CustomerID']}'" : 'NULL') . ', `CompanyName`=' . ($data['CompanyName'] !== '' && $data['CompanyName'] !== NULL ? "'{$data['CompanyName']}'" : 'NULL') . ', `ContactName`=' . ($data['ContactName'] !== '' && $data['ContactName'] !== NULL ? "'{$data['ContactName']}'" : 'NULL') . ', `ContactTitle`=' . ($data['ContactTitle'] !== '' && $data['ContactTitle'] !== NULL ? "'{$data['ContactTitle']}'" : 'NULL') . ', `Address`=' . ($data['Address'] !== '' && $data['Address'] !== NULL ? "'{$data['Address']}'" : 'NULL') . ', `City`=' . ($data['City'] !== '' && $data['City'] !== NULL ? "'{$data['City']}'" : 'NULL') . ', `Region`=' . ($data['Region'] !== '' && $data['Region'] !== NULL ? "'{$data['Region']}'" : 'NULL') . ', `PostalCode`=' . ($data['PostalCode'] !== '' && $data['PostalCode'] !== NULL ? "'{$data['PostalCode']}'" : 'NULL') . ', `Country`=' . ($data['Country'] !== '' && $data['Country'] !== NULL ? "'{$data['Country']}'" : 'NULL') . ', `Phone`=' . ($data['Phone'] !== '' && $data['Phone'] !== NULL ? "'{$data['Phone']}'" : 'NULL') . ', `Fax`=' . ($data['Fax'] !== '' && $data['Fax'] !== NULL ? "'{$data['Fax']}'" : 'NULL') . " where `CustomerID`='" . makeSafe($selected_id) . "'", $o);
if ($o['error'] != '') {
echo $o['error'];
echo '<a href="customers_view.php?SelectedID=' . urlencode($selected_id) . "\">{$Translation['< back']}</a>";
exit;
}
$data['selectedID'] = $data['CustomerID'];
// hook: customers_after_update
if (function_exists('customers_after_update')) {
$res = sql("SELECT * FROM `customers` WHERE `CustomerID`='{$data['selectedID']}' LIMIT 1", $eo);
if ($row = db_fetch_assoc($res)) {
$data = array_map('makeSafe', $row);
}
$data['selectedID'] = $data['CustomerID'];
$args = array();
if (!customers_after_update($data, getMemberInfo(), $args)) {
return;
}
}
// mm: update ownership data
sql("update membership_userrecords set dateUpdated='" . time() . "', pkValue='{$data['CustomerID']}' where tableName='customers' and pkValue='" . makeSafe($selected_id) . "'", $eo);
}
示例9: fwrite
}
//// END UPGRADE UPGRADEWIZARD
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// MAKE SURE PATCH IS COMPATIBLE
if (is_file("{$unzip_dir}/manifest.php")) {
// provides $manifest array
include "{$unzip_dir}/manifest.php";
if (!isset($manifest)) {
fwrite(STDERR, "\nThe patch did not contain a proper manifest.php file. Cannot continue.\n\n");
exit(1);
} else {
copy("{$unzip_dir}/manifest.php", $sugar_config['upload_dir'] . "/upgrades/patch/{$zip_from_dir}-manifest.php");
$error = validate_manifest($manifest);
if (!empty($error)) {
$error = strip_tags(br2nl($error));
fwrite(STDERR, "\n{$error}\n\nFAILURE\n");
exit(1);
}
}
} else {
fwrite(STDERR, "\nThe patch did not contain a proper manifest.php file. Cannot continue.\n\n");
exit(1);
}
$ce_to_pro_ent = isset($manifest['name']) && ($manifest['name'] == 'SugarCE to SugarPro' || $manifest['name'] == 'SugarCE to SugarEnt' || $manifest['name'] == 'SugarCE to SugarCorp' || $manifest['name'] == 'SugarCE to SugarUlt');
$_SESSION['upgrade_from_flavor'] = $manifest['name'];
global $sugar_config;
global $sugar_version;
global $sugar_flavor;
//// END MAKE SURE PATCH IS COMPATIBLE
///////////////////////////////////////////////////////////////////////////////
示例10: floor
$drawing->setOffsetX(10);
$drawing->setOffsetY(10);
}
$vn_width = floor(intval($va_info['PROPERTIES']['width']) * $vn_ratio_pixels_to_excel_width);
$vn_height = floor(intval($va_info['PROPERTIES']['height']) * $vn_ratio_pixels_to_excel_height);
// set the calculated withs for the current row and column,
// but make sure we don't make either smaller than they already are
if ($vn_width > $o_sheet->getColumnDimension($vs_supercol . $vs_column)->getWidth()) {
$o_sheet->getColumnDimension($vs_supercol . $vs_column)->setWidth($vn_width);
}
if ($vn_height > $o_sheet->getRowDimension($vn_line)->getRowHeight()) {
$o_sheet->getRowDimension($vn_line)->setRowHeight($vn_height);
}
}
} elseif ($vs_display_text = $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request, 'purify' => true), is_array($va_info['settings']) ? $va_info['settings'] : array()))) {
$o_sheet->setCellValue($vs_supercol . $vs_column . $vn_line, html_entity_decode(strip_tags(br2nl($vs_display_text)), ENT_QUOTES | ENT_HTML5));
// We trust the autosizing up to a certain point, but
// we want column widths to be finite :-).
// Since Arial is not fixed-with and font rendering
// is different from system to system, this can get a
// little dicey. The values come from experimentation.
if ($o_sheet->getColumnDimension($vs_supercol . $vs_column)->getWidth() == -1) {
// don't overwrite existing settings
if (strlen($vs_display_text) > 55) {
$o_sheet->getColumnDimension($vs_supercol . $vs_column)->setWidth(50);
}
}
}
if (!($vs_column = next($va_a_to_z))) {
$vs_supercol = array_shift($va_supercol_a_to_z);
$vs_column = reset($va_a_to_z);
示例11: sprintf
$db->query($query);
$db->next_record();
// przypisanie zmiennych
$id = $db->f('id');
$title = $db->f('title');
$text = $db->f('text');
$author = $db->f('author');
if ((bool) $rewrite) {
$perma_link = '1,' . $id . ',1,item.html';
$form_link = '1,3,item.html';
} else {
$perma_link = 'index.php?p=1&id=' . $id;
$form_link = 'index.php?p=3&action=add';
}
// przypisanie tablicy szablonów::ft
$ft->assign(array('NEWS_TITLE' => $title, 'NEWS_ID' => $id, 'NEWS_TEXT' => $text, 'NEWS_AUTHOR' => $author, 'COMMENT_AUTHOR' => $comment_author, 'QUOTE' => sprintf('[quote]%s[/quote]', strip_tags(br2nl($cite))), 'STRING' => $page_string, 'PERMA_LINK' => $perma_link, 'FORM_LINK' => $form_link));
} else {
$query = sprintf("\r\n SELECT\r\n *\r\n FROM\r\n %s\r\n WHERE\r\n id = '%d'\r\n LIMIT 1", TABLE_MAIN, $_GET['id']);
$db->query($query);
$db->next_record();
// przypisanie zmiennych
$id = $db->f('id');
$title = $db->f('title');
$text = $db->f('text');
$author = $db->f('author');
if ((bool) $rewrite) {
$perma_link = sprintf('1,%s,1,item.html', $id);
$form_link = '1,3,item.html';
} else {
$perma_link = 'index.php?p=1&id=' . $id;
$form_link = 'index.php?p=3&action=add';
示例12: trim
$infotext = trim($sql3['infotext']);
function br2nl($text)
{
return str_replace('<br />', '', $text);
}
$isOwnProfile = FALSE;
if ($_GET['id'] == $cookie_id && $cookie_id != CONFIG_DEMO_USER) {
$isOwnProfile = TRUE;
if (isset($_POST['infotext'])) {
$infotext = nl2br(mb_substr(strip_tags(trim($_POST['infotext'])), 0, 10000));
$infotext1 = "UPDATE " . $prefix . "users SET infotext = '" . mysql_real_escape_string($infotext) . "' WHERE ids = '" . $cookie_id . "'";
$infotext2 = mysql_query($infotext1);
}
}
echo '<h1 id="anker_infotext">' . _('Infotext') . ($isOwnProfile ? ' (' . __('%s Zeichen', '<span id="infotext_counter">0</span>/5000') . ')' : '') . '</h1>';
if ($isOwnProfile) {
// eigenes Profil
echo '<form action="/manager.php?id=' . $_GET['id'] . '" method="post" accept-charset="utf-8">';
echo '<p><textarea rows="15" cols="12" id="infotext" name="infotext" style="width:100%; height:300px" maxlength="5000" onkeyup="updateTextLength(this);">' . br2nl($infotext) . '</textarea></p>';
echo '<p><input type="submit" value="' . _('Speichern') . '"' . noDemoClick($cookie_id) . ' /></p>';
} else {
// fremdes Profil
if (strlen($infotext) == 0) {
echo '<p>' . __('%s hat noch keinen Text über sich und den Verein geschrieben.', $sql3['username']) . '</p>';
} else {
echo '<p>' . $infotext . '</p>';
}
}
}
// INFOTEXT ENDE
include 'zz3.php';
示例13: getEmailDetails
function getEmailDetails($email)
{
$details = "";
if (!empty($email->to_addrs)) {
$details .= "To: " . $email->to_addrs . "<br>";
}
if (!empty($email->from_addr)) {
$details .= "From: " . $email->from_addr . "<br>";
}
if (!empty($email->cc_addrs)) {
$details .= "CC: " . $email->cc_addrs . "<br>";
}
if (!empty($email->from_addr) || !empty($email->cc_addrs) || !empty($email->to_addrs)) {
$details .= "<br>";
}
// cn: bug 8433 - history does not distinguish b/t text/html emails
$details .= empty($email->description_html) ? $this->formatDescription($email->description) : $this->formatDescription(strip_tags(br2nl(from_html($email->description_html))));
return $details;
}
示例14: elseif
} elseif ($pmodule == 'Leads') {
require_once 'modules/Leads/Leads.php';
$myfocus = new Leads();
$myfocus->retrieve_entity_info($mycrmid, "Leads");
} elseif ($pmodule == 'Vendors') {
require_once 'modules/Vendors/Vendors.php';
$myfocus = new Vendors();
$myfocus->retrieve_entity_info($mycrmid, "Vendors");
} else {
// vtlib customization: Enabling mail send from other modules
$myfocus = CRMEntity::getInstance($pmodule);
$myfocus->retrieve_entity_info($mycrmid, $pmodule);
// END
}
$fldname = $adb->query_result($fresult, 0, "columnname");
$emailadd = br2nl($myfocus->column_fields[$fldname]);
//This is to convert the html encoded string to original html entities so that in mail description contents will be displayed correctly
//$focus->column_fields['description'] = from_html($focus->column_fields['description']);
if ($emailadd != '') {
$description = getMergedDescription($_REQUEST['description'], $mycrmid, $pmodule);
//Email Open Tracking
global $site_URL, $application_unique_key;
$emailid = $focus->id;
$track_URL = "{$site_URL}/modules/Emails/TrackAccess.php?record={$mycrmid}&mailid={$emailid}&app_key={$application_unique_key}";
$description = "<img src='{$track_URL}' alt='' width='1' height='1'>{$description}";
// END
$pos = strpos($description, '$logo$');
if ($pos !== false) {
$description = str_replace('$logo$', '<img src="cid:logo" />', $description);
$logo = 1;
}
示例15: UserSignature
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
********************************************************************************/
require_once 'modules/Users/UserSignature.php';
global $current_user;
$us = new UserSignature();
if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) {
$us->retrieve($_REQUEST['record']);
} else {
$us->id = create_guid();
$us->new_with_id = true;
}
$us->name = $_REQUEST['name'];
$us->signature = strip_tags(br2nl(from_html($_REQUEST['description'])));
$us->signature_html = $_REQUEST['description'];
if (empty($us->user_id) && isset($_REQUEST['the_user_id'])) {
$us->user_id = $_REQUEST['the_user_id'];
} else {
$us->user_id = $current_user->id;
}
//_pp($_REQUEST);
//_pp($us);
$us->save();
$js = '
<script type="text/javascript">
function refreshTemplates() {
window.opener.refresh_signature_list("' . $us->id . '","' . $us->name . '");
window.close();
}