本文整理汇总了PHP中dol_htmlentities函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_htmlentities函数的具体用法?PHP dol_htmlentities怎么用?PHP dol_htmlentities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_htmlentities函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: img_warning
if (!in_array($basedir, $listdir)) {
print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
dol_syslog("safe_mode is on, basedir is " . $basedir . ", safe_mode_exec_dir is " . ini_get('safe_mode_exec_dir'), LOG_WARNING);
}
}
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="' . (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? dol_htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND) : '') . '">';
print "</td>";
print '</tr>';
// Use anti virus
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td colspan="2">' . $langs->trans("AntiVirusParam") . '<br>';
print $langs->trans("AntiVirusParamExample");
print '</td>';
print '<td>';
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="' . (!empty($conf->global->MAIN_ANTIVIRUS_PARAM) ? dol_htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM) : '') . '">';
print "</td>";
print '</tr>';
print '</table>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="button" value="' . $langs->trans("Modify") . '"></div>';
print '</form>';
// Form to test upload
print '<br>';
$formfile = new FormFile($db);
$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0);
// List of document
$filearray = dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1);
$formfile->list_of_documents($filearray, '', 'admin_temp', '');
llxFooter();
$db->close();
示例2: GETPOST
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1);
print $formconfirm;
}
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/action/listactions.php">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback, $user->societe_id ? 0 : 1, 'id', 'ref', '');
print '</td></tr>';
// Type
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<tr><td>' . $langs->trans("Type") . '</td><td colspan="3">' . $object->type . '</td></tr>';
}
// Title
print '<tr><td>' . $langs->trans("Title") . '</td><td colspan="3">' . dol_htmlentities($object->label) . '</td></tr>';
// Full day event
print '<tr><td>' . $langs->trans("EventOnFullDay") . '</td><td colspan="3">' . yn($object->fulldayevent, 3) . '</td></tr>';
$rowspan = 4;
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
$rowspan++;
}
// Date start
print '<tr><td width="30%">' . $langs->trans("DateActionStart") . '</td><td colspan="3">';
if (!$object->fulldayevent) {
print dol_print_date($object->datep, 'dayhour');
} else {
print dol_print_date($object->datep, 'day');
}
if ($object->percentage == 0 && $object->datep && $object->datep < $now - $delay_warning) {
print img_warning($langs->trans("Late"));
示例3: dol_buildpath
print '<img src="' . dol_buildpath('/opensurvey/img/medaille.png', 1) . '"> ' . $langs->trans('TheBestChoices') . ": <b>" . $meilleursujet . "</b> " . $langs->trans('with') . " <b>{$meilleurecolonne} </b>" . $vote_str . ".\n";
}
print '</p><br>' . "\n";
}
}
print '<br>';
// Comment list
$comments = $object->getComments();
if ($comments) {
print "<br><b>" . $langs->trans("CommentsOfVoters") . ":</b><br>\n";
foreach ($comments as $obj) {
print '<div class="comment"><span class="usercomment">';
if (in_array($obj->usercomment, $listofvoters)) {
print '<a href="' . $_SERVER["PHP_SELF"] . '?deletecomment=' . $obj->id_comment . '&sondage=' . $numsondage . '"> ' . img_picto('', 'delete.png') . '</a> ';
}
print dol_htmlentities($obj->usercomment) . ':</span> <span class="comment">' . dol_nl2br(dol_htmlentities($obj->comment)) . "</span></div>";
}
}
// Form to add comment
if ($object->allow_comments) {
print '<div class="addcomment">' . $langs->trans("AddACommentForPoll") . "<br>\n";
print '<textarea name="comment" rows="2" cols="60"></textarea><br>' . "\n";
print $langs->trans("Name") . ': ';
print '<input type="text" name="commentuser" maxlength="64" /> ' . "\n";
print '<input type="submit" class="button" name="ajoutcomment" value="' . dol_escape_htmltag($langs->trans("AddComment")) . '"><br>' . "\n";
print '</form>' . "\n";
print '</div>' . "\n";
// div add comment
}
print '<br><br>';
print '<a name="bas"></a>' . "\n";
示例4: dol_buildpath
print '<a href="' . dol_buildpath('/opensurvey/card.php', 1) . '?id=' . $obj->id_sondage . '">' . img_picto('', 'object_opensurvey') . ' ' . $obj->id_sondage . '</a>';
print '</td><td>' . dol_htmlentities($obj->titre) . '</td><td>';
$type = $obj->format == 'A' ? 'classic' : 'date';
print img_picto('', dol_buildpath('/opensurvey/img/' . ($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1);
print ' ' . $langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate");
print '</td><td>';
// Author
if ($obj->fk_user_creat) {
$userstatic = new User($db);
$userstatic->id = $obj->fk_user_creat;
$userstatic->firstname = $obj->firstname;
$userstatic->lastname = $obj->lastname;
$userstatic->login = $userstatic->getFullName($langs, 0, -1, 48);
print $userstatic->getLoginUrl(1);
} else {
print dol_htmlentities($obj->nom_admin);
}
print '</td>';
print '<td align="center">' . dol_print_date($db->jdate($obj->date_fin), 'day');
if ($db->jdate($obj->date_fin) < time()) {
print ' (' . $langs->trans("Expired") . ')';
}
print '</td>';
print '<td align="center">' . $nbuser . '</td>' . "\n";
print '</tr>' . "\n";
$i++;
}
print '</table>' . "\n";
print '</form>';
print '</div>' . "\n";
llxFooter();
示例5: dol_htmlentitiesbr
/**
* This function is called to encode a string into a HTML string but differs from htmlentities because
* all entities but &,<,> are converted. This permits to encode special chars to entities with no double
* encoding for already encoded HTML strings.
* This function also remove last CR/BR.
* For PDF usage, you can show text by 2 ways:
* - writeHTMLCell -> param must be encoded into HTML.
* - MultiCell -> param must not be encoded into HTML.
* Because writeHTMLCell convert also \n into <br>, if function
* is used to build PDF, nl2brmode must be 1.
* @param stringtoencode String to encode
* @param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
* @param pagecodefrom Pagecode stringtoencode is encoded
*/
function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8')
{
if (dol_textishtml($stringtoencode)) {
$newstring = $stringtoencode;
//$newstring=preg_replace('/([^<li\s*>]+)(\r\n|\r|\n)+/i',($forxml?'$1<br />':'$1<br>'),$stringtoencode); // Don't replace if in list
//$newstring=preg_replace('/<li\s*>(\r\n|\r|\n)+/','__li__',$newstring); // Don't replace if \n is just after a li
//$newstring=preg_replace('/(\r\n|\r|\n)+/i',($forxml?'<br />':'<br>'),$newstring); // If already HTML, CR should be <br> so we don't change \n
$newstring = preg_replace('/<br(\\s[\\sa-zA-Z_="]*)?\\/?>/i', '<br>', $newstring);
// Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
$newstring = preg_replace('/<br>$/i', '', $newstring);
// Remove last <br>
$newstring = strtr($newstring, array('&' => '__and__', '<' => '__lt__', '>' => '__gt__', '"' => '__dquot__'));
$newstring = dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom);
// Make entity encoding
$newstring = strtr($newstring, array('__and__' => '&', '__lt__' => '<', '__gt__' => '>', '__dquot__' => '"'));
//$newstring=strtr($newstring,array('__li__'=>"<li>\n")); // Restore <li>\n
} else {
$newstring = dol_nl2br(dol_htmlentities($stringtoencode, ENT_COMPAT, $pagecodefrom), $nl2brmode);
}
// Other substitutions that htmlentities does not do
//$newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80. Not in html entity table.
return $newstring;
}
示例6: top_htmlhead
/**
* Ouput html header of a page.
* This code is also duplicated into security2.lib.php::dol_loginfunction
*
* @param string $head Optionnal head lines
* @param string $title HTML title
* @param int $disablejs More content into html header
* @param int $disablehead More content into html header
* @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files
* @return void
*/
function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
{
global $user, $conf, $langs, $db;
top_httphead();
if (empty($conf->css)) {
$conf->css = '/theme/eldy/style.css.php';
}
// If not defined, eldy by default
if (empty($conf->global->MAIN_ACTIVATE_HTML5)) {
$doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
} else {
$doctype = '<!doctype html>';
// Html5 - Developement - Only available on Eldy template
}
print $doctype . "\n";
if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) {
print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_URL_ROOT . '/cache.manifest">' . "\n";
} else {
print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
}
//print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
if (empty($disablehead)) {
print "<head>\n";
if (GETPOST('dol_basehref')) {
print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref')) . '">' . "\n";
}
// Displays meta
print '<meta name="robots" content="noindex,nofollow">' . "\n";
// Do not index
print '<meta name="viewport" content="width=device-width, initial-scale=1">';
// Scale for mobile device
print '<meta name="author" content="Dolibarr Development Team">' . "\n";
if (!empty($conf->global->MAIN_ACTIVATE_HTML5)) {
print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n";
}
// Needed for Responsive Web Design
$favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
if (!empty($conf->global->MAIN_FAVICON_URL)) {
$favicon = $conf->global->MAIN_FAVICON_URL;
}
print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
print '<link rel="top" title="' . $langs->trans("Home") . '" href="' . (DOL_URL_ROOT ? DOL_URL_ROOT : '/') . '">' . "\n";
}
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">' . "\n";
}
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
print '<link rel="author" title="Dolibarr Development Team" href="http://www.dolibarr.org">' . "\n";
}
// Displays title
$appli = 'Dolibarr';
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli = $conf->global->MAIN_APPLICATION_TITLE;
}
if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) {
print '<title>' . dol_htmlentities($title) . '</title>';
}
if ($title) {
print '<title>' . dol_htmlentities($appli . ' - ' . $title) . '</title>';
} else {
print "<title>" . dol_htmlentities($appli) . "</title>";
}
print "\n";
$ext = '';
if (!empty($conf->dol_use_jmobile)) {
$ext = 'version=' . urlencode(DOL_VERSION);
}
if (GETPOST('version')) {
$ext = 'version=' . GETPOST('version', 'int');
}
// usefull to force no cache on css/js
if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n";
$jquerytheme = 'smoothness';
if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
$jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
}
if (constant('JS_JQUERY_UI')) {
print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
} else {
print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
}
// JQuery
print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/tiptip/tipTip.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
// Tooltip
print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
// JNotify
//.........这里部分代码省略.........
示例7: explode
$compteursujet = 0;
$meilleursujet = '';
for ($i = 0; $i < $nbcolonnes; $i++) {
if (isset($sumfor[$i]) === true && isset($meilleurecolonne) === true && $sumfor[$i] == $meilleurecolonne) {
$meilleursujet .= ", ";
if ($object->format == "D") {
$meilleursujetexport = $toutsujet[$i];
if (strpos($toutsujet[$i], '@') !== false) {
$toutsujetdate = explode("@", $toutsujet[$i]);
$meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext') . ' (' . dol_print_date($toutsujetdate[0], '%A') . ')' . ' - ' . $toutsujetdate[1];
} else {
$meilleursujet .= dol_print_date($toutsujet[$i], 'daytext') . ' (' . dol_print_date($toutsujet[$i], '%A') . ')';
}
} else {
$tmps = explode('@', $toutsujet[$i]);
$meilleursujet .= dol_htmlentities($tmps[0]);
}
$compteursujet++;
}
}
$meilleursujet = substr("{$meilleursujet}", 1);
$meilleursujet = str_replace("°", "'", $meilleursujet);
// Show best choice
if ($nbofcheckbox >= 2) {
$vote_str = $langs->trans('votes');
print '<p class="affichageresultats">' . "\n";
if (isset($meilleurecolonne) && $compteursujet == "1") {
print "<img src=\"" . dol_buildpath('/opensurvey/img/medaille.png', 1) . "\"> " . $langs->trans('TheBestChoice') . ": <b>" . $meilleursujet . " </b>" . $langs->trans("with") . " <b>{$meilleurecolonne} </b>" . $vote_str . ".\n";
} elseif (isset($meilleurecolonne)) {
print "<img src=\"" . dol_buildpath('/opensurvey/img/medaille.png', 1) . "\"> " . $langs->trans('TheBestChoices') . ": <b>" . $meilleursujet . " </b>" . $langs->trans("with") . " <b>{$meilleurecolonne} </b>" . $vote_str . ".\n";
}
示例8: run_sql
//.........这里部分代码省略.........
}
if (!$silent) {
print '<div class="error">' . $langs->trans("Failed to get max rowid for " . $table) . "</div></td>";
}
if (!$silent) {
print '</tr>';
}
$error++;
break;
}
}
$from = '__+MAX_' . $table . '__';
$to = '+' . $listofmaxrowid[$table];
$newsql = str_replace($from, $to, $newsql);
dol_syslog('Admin.lib::run_sql New Request ' . ($i + 1) . ' (replacing ' . $from . ' to ' . $to . ')', LOG_DEBUG);
$arraysql[$i] = $newsql;
}
}
// Loop on each request to execute request
$cursorinsert = 0;
$listofinsertedrowid = array();
foreach ($arraysql as $i => $sql) {
if ($sql) {
// Replace the prefix tables
if (MAIN_DB_PREFIX != 'llx_') {
$sql = preg_replace('/llx_/i', MAIN_DB_PREFIX, $sql);
}
if (!empty($handler)) {
$sql = preg_replace('/__HANDLER__/i', "'" . $handler . "'", $sql);
}
$newsql = preg_replace('/__ENTITY__/i', !empty($entity) ? $entity : $conf->entity, $sql);
// Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes)
if (!$silent) {
print '<tr><td valign="top">' . $langs->trans("Request") . ' ' . ($i + 1) . " sql='" . dol_htmlentities($newsql, ENT_NOQUOTES) . "'</td></tr>\n";
}
dol_syslog('Admin.lib::run_sql Request ' . ($i + 1), LOG_DEBUG);
$sqlmodified = 0;
// Replace for encrypt data
if (preg_match_all('/__ENCRYPT\\(\'([^\']+)\'\\)__/i', $newsql, $reg)) {
$num = count($reg[0]);
for ($j = 0; $j < $num; $j++) {
$from = $reg[0][$j];
$to = $db->encrypt($reg[1][$j], 1);
$newsql = str_replace($from, $to, $newsql);
}
$sqlmodified++;
}
// Replace for decrypt data
if (preg_match_all('/__DECRYPT\\(\'([A-Za-z0-9_]+)\'\\)__/i', $newsql, $reg)) {
$num = count($reg[0]);
for ($j = 0; $j < $num; $j++) {
$from = $reg[0][$j];
$to = $db->decrypt($reg[1][$j]);
$newsql = str_replace($from, $to, $newsql);
}
$sqlmodified++;
}
// Replace __x__ with rowid of insert nb x
while (preg_match('/__([0-9]+)__/', $newsql, $reg)) {
$cursor = $reg[1];
if (empty($listofinsertedrowid[$cursor])) {
if (!$silent) {
print '<tr><td valign="top" colspan="2">';
}
if (!$silent) {
print '<div class="error">' . $langs->trans("FileIsNotCorrect") . "</div></td>";
示例9: print_fiche_titre
}
print '</div>';
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"] . '?&id=' . $numsondage, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll", $id), 'delete_confirm', '', '', 1);
}
print '<br>';
print '<form name="formulaire5" action="#" method="POST">' . "\n";
print_fiche_titre($langs->trans("CommentsOfVoters"), '', '');
// Comment list
$comments = $object->getComments();
if ($comments) {
foreach ($comments as $comment) {
if ($user->rights->opensurvey->write) {
print '<a href="' . dol_buildpath('/opensurvey/card.php', 1) . '?deletecomment=' . $comment->id_comment . '&id=' . $numsondage . '"> ' . img_picto('', 'delete.png') . '</a> ';
}
print dol_htmlentities($comment->usercomment) . ': ' . dol_nl2br(dol_htmlentities($comment->comment)) . " <br>";
}
} else {
print $langs->trans("NoCommentYet") . '<br>';
}
print '<br>';
// Add comment
if ($object->allow_comments) {
print $langs->trans("AddACommentForPoll") . '<br>';
print '<textarea name="comment" rows="2" cols="80"></textarea><br>' . "\n";
print $langs->trans("Name") . ': <input type="text" name="commentuser" value="' . $user->getFullName($langs) . '"><br>' . "\n";
print '<input type="submit" class="button" name="ajoutcomment" value="' . dol_escape_htmltag($langs->trans("AddComment")) . '"><br>' . "\n";
if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide == "yes") {
print "<font color=#FF0000>" . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")) . "</font>";
}
}
示例10: array
$return = array();
if ($db->num_rows($query)) {
$productstatic = new Product($db);
while ($objp = $db->fetch_object($query)) {
$var = !$var;
$productstatic->id = $objp->rowid;
$productstatic->ref = $objp->ref;
$productstatic->label = $objp->label;
$productstatic->type = $objp->fk_product_type;
$productstatic->entity = $objp->entity;
print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">';
print $productstatic->getNomUrl(1);
print '</td>';
print '<td align="center">';
print dol_trunc(dol_htmlentities($objp->label), 30);
print '</td>';
print '<td align="right" class="nowrap">' . dol_print_date($objp->tms) . '</td>';
print '</tr>';
}
}
print '</table>';
}
/*
* Last supplier orders
*/
$orderstatic = new CommandeFournisseur($db);
if ($user->rights->fournisseur->commande->lire) {
// TODO move to DAO class
// Check if there are supplier orders billable
$sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
示例11: showrefnav
/**
* Return a HTML area with the reference of object and a navigation bar for a business object
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
*
* @param object $object Object to show
* @param string $paramid Name of parameter to use to name the id into the URL link
* @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1)
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* @param string $morehtmlref Code html supplementaire a afficher apres ref
* @param string $moreparam More param to add in nav link url.
* @param int $nodbprefix Do not include DB prefix to forge table name
* @return string Portion HTML avec ref + boutons nav
*/
function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0)
{
global $langs, $conf;
$ret = '';
if (empty($fieldid)) {
$fieldid = 'rowid';
}
if (empty($fieldref)) {
$fieldref = 'ref';
}
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref(isset($object->next_prev_filter) ? $object->next_prev_filter : '', $fieldid, $nodbprefix);
$previous_ref = $object->ref_previous ? '<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? img_picto($langs->trans("Previous"), 'previous.png') : ' ') . '</a>' : '';
$next_ref = $object->ref_next ? '<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? img_picto($langs->trans("Next"), 'next.png') : ' ') . '</a>' : '';
//print "xx".$previous_ref."x".$next_ref;
if ($previous_ref || $next_ref || $morehtml) {
$ret .= '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
}
$ret .= dol_htmlentities($object->{$fieldref});
if ($morehtmlref) {
$ret .= ' ' . $morehtmlref;
}
if ($morehtml) {
$ret .= '</td><td class="paddingrightonly" align="right">' . $morehtml;
}
if ($shownav && ($previous_ref || $next_ref)) {
$ret .= '</td><td class="nobordernopadding" align="center" width="20">' . $previous_ref . '</td>';
$ret .= '<td class="nobordernopadding" align="center" width="20">' . $next_ref;
}
if ($previous_ref || $next_ref || $morehtml) {
$ret .= '</td></tr></table>';
}
return $ret;
}
示例12: showrefnav
/**
* Return a HTML area with the reference of object and a navigation bar for a business object
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
*
* @param object $object Object to show
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
* @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1)
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* @param string $morehtmlref More html to show after ref
* @param string $moreparam More param to add in nav link url.
* @param int $nodbprefix Do not include DB prefix to forge table name
* @param string $morehtmlleft More html code to show before ref
* @param string $morehtmlright More html code to show before navigation arrows
* @return string Portion HTML avec ref + boutons nav
*/
function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlright = '')
{
global $langs, $conf;
$ret = '';
if (empty($fieldid)) {
$fieldid = 'rowid';
}
if (empty($fieldref)) {
$fieldref = 'ref';
}
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref(isset($object->next_prev_filter) ? $object->next_prev_filter : '', $fieldid, $nodbprefix);
//$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'</a>':'';
//$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'</a>':'';
$previous_ref = $object->ref_previous ? '<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? '<' : ' ') . '</a>' : '';
$next_ref = $object->ref_next ? '<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? '>' : ' ') . '</a>' : '';
//print "xx".$previous_ref."x".$next_ref;
$ret .= '<div style="vertical-align: middle">';
$ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>';
$ret .= '<div class="inline-block floatleft valignmiddle refid' . ($shownav && ($previous_ref || $next_ref) ? ' refidpadding' : '') . '">';
// For thirdparty and contact, the ref is the id, so we show something else
if ($object->element == 'societe') {
$ret .= dol_htmlentities($object->name);
} else {
if (in_array($object->element, array('contact', 'user', 'member'))) {
$ret .= dol_htmlentities($object->getFullName($langs));
} else {
$ret .= dol_htmlentities($object->{$fieldref});
}
}
if ($morehtmlref) {
$ret .= ' ' . $morehtmlref;
}
$ret .= '</div>';
if ($previous_ref || $next_ref || $morehtml) {
$ret .= '<div class="pagination"><ul>';
}
if ($morehtml) {
$ret .= '<li class="noborder litext">' . $morehtml . '</li>';
}
if ($shownav && ($previous_ref || $next_ref)) {
$ret .= '<li class="pagination">' . $previous_ref . '</li>';
$ret .= '<li class="pagination">' . $next_ref . '</li>';
}
if ($previous_ref || $next_ref || $morehtml) {
$ret .= '</ul></div>';
}
if ($morehtmlright) {
$ret .= '<div class="statusref">' . $morehtmlright . '</div>';
}
$ret .= '</div>';
return $ret;
}
示例13: dol_htmlentitiesbr
/**
* This function is called to encode a string into a HTML string but differs from htmlentities because
* a detection is done before to see if text is already HTML or not. Also, all entities but &,<,> are converted.
* This permits to encode special chars to entities with no double encoding for already encoded HTML strings.
* This function also remove last EOL or BR if $removelasteolbr=1 (default).
* For PDF usage, you can show text by 2 ways:
* - writeHTMLCell -> param must be encoded into HTML.
* - MultiCell -> param must not be encoded into HTML.
* Because writeHTMLCell convert also \n into <br>, if function
* is used to build PDF, nl2brmode must be 1.
*
* @param string $stringtoencode String to encode
* @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
* @param string $pagecodefrom Pagecode stringtoencode is encoded
* @param int $removelasteolbr 1=Remove last br or lasts \n (default), 0=Do nothing
* @return string String encoded
*/
function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8', $removelasteolbr = 1)
{
$newstring = $stringtoencode;
if (dol_textishtml($stringtoencode)) {
$newstring = preg_replace('/<br(\\s[\\sa-zA-Z_="]*)?\\/?>/i', '<br>', $newstring);
// Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
if ($removelasteolbr) {
$newstring = preg_replace('/<br>$/i', '', $newstring);
}
// Remove last <br> (remove only last one)
$newstring = strtr($newstring, array('&' => '__and__', '<' => '__lt__', '>' => '__gt__', '"' => '__dquot__'));
$newstring = dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom);
// Make entity encoding
$newstring = strtr($newstring, array('__and__' => '&', '__lt__' => '<', '__gt__' => '>', '__dquot__' => '"'));
} else {
if ($removelasteolbr) {
$newstring = preg_replace('/(\\r\\n|\\r|\\n)$/i', '', $newstring);
}
// Remove last \n (may remove several)
$newstring = dol_nl2br(dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom), $nl2brmode);
}
// Other substitutions that htmlentities does not do
//$newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80. Not in html entity table. // Seems useles with TCPDF. Make bug with UTF8 languages
return $newstring;
}