本文整理汇总了PHP中dol_textishtml函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_textishtml函数的具体用法?PHP dol_textishtml怎么用?PHP dol_textishtml使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_textishtml函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dolGetFirstLineOfText
/**
* Return first line of text. Cut will depends if content is HTML or not.
*
* @param string $text Input text
* @return string Output text
* @see dol_nboflines_bis
*/
function dolGetFirstLineOfText($text)
{
if (dol_textishtml($text)) {
$firstline = preg_replace('/<br[^>]*>.*$/s', '', $text);
// The s pattern modifier means the . can match newline characters
} else {
$firstline = preg_replace('/[\\n\\r].*/', '', $text);
}
return $firstline . (strlen($firstline) != strlen($text) ? '...' : '');
}
示例2: makeSubstitution
/**
* Make substitution
*
* @param $object Adherent Object
* @return string Value of input text string with substitutions done
*/
function makeSubstitution($object)
{
global $conf, $langs;
$text = $this->body;
$birthday = dol_print_date($object->naiss, 'day');
$msgishtml = 0;
if (dol_textishtml($text, 1)) {
$msgishtml = 1;
}
$infos = '';
// Specific for Photo
$photoName = $object->photo;
$photoType = $object->_attachments->{$photoName}->content_type;
$photoBase64 = $object->getFileBase64($object->photo);
$photo = '<img src="data:' . $PhotoType . ';base64,' . $photoBase64 . '"/>';
// Substitutions
$substitutionarray = array('__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT, '__ID__' => $msgishtml ? dol_htmlentitiesbr($object->login) : $object->login, '__CIVILITE__' => $object->getCivilityLabel($msgishtml ? 0 : 1), '__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($object->Firstname) : $object->Firstname, '__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($object->Lastname) : $object->Lastname, '__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($object->getFullName($langs)) : $object->getFullName($langs), '__COMPANY__' => $msgishtml ? dol_htmlentitiesbr($object->societe) : $object->societe, '__ADDRESS__' => $msgishtml ? dol_htmlentitiesbr($object->address) : $object->address, '__ZIP__' => $msgishtml ? dol_htmlentitiesbr($object->zip) : $object->zip, '__TOWN__' => $msgishtml ? dol_htmlentitiesbr($object->town) : $object->town, '__COUNTRY__' => $msgishtml ? dol_htmlentitiesbr($object->country) : $object->country, '__EMAIL__' => $msgishtml ? dol_htmlentitiesbr($object->email) : $object->email, '__NAISS__' => $msgishtml ? dol_htmlentitiesbr($birthday) : $birthday, '__PHOTO__' => $photo, '__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($object->login) : $object->login, '__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($object->pass) : $object->pass, '__STATUS__' => $object->getLibStatus(), '__INFOS__' => $msgishtml ? dol_htmlentitiesbr($infos) : $infos, '__PRENOM__' => $msgishtml ? dol_htmlentitiesbr($object->Firstname) : $object->Firstname, '__NOM__' => $msgishtml ? dol_htmlentitiesbr($object->Lastname) : $object->Lastname, '__SOCIETE__' => $msgishtml ? dol_htmlentitiesbr($object->societe) : $object->societe, '__ADRESSE__' => $msgishtml ? dol_htmlentitiesbr($object->address) : $object->address, '__CP__' => $msgishtml ? dol_htmlentitiesbr($object->zip) : $object->zip, '__VILLE__' => $msgishtml ? dol_htmlentitiesbr($object->town) : $object->town, '__PAYS__' => $msgishtml ? dol_htmlentitiesbr($object->country) : $object->country);
complete_substitutions_array($substitutionarray, $langs);
$this->body = make_substitutions($text, $substitutionarray);
return 1;
}
示例3: if
else
{
print ' ';
}
print "</td></tr>\n";
}
// Custom code
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$product->customcode.'</td>';
// Origin country code
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($product->country_id,0,$db).'</td>';
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.(dol_textishtml($product->note)?$product->note:dol_nl2br($product->note,1,true)).'</td></tr>';
print "</table>\n";
}
else
{
$canvas->assign_values('view');
$canvas->display_canvas();
}
dol_fiche_end();
}
}
else if ($action != 'create')
{
示例4: dol_concatdesc
/**
* Concat 2 descriptions (second one after first one with a new line separator if required)
* text1 html + text2 html => text1 + '<br>' + text2
* text1 html + text2 txt => text1 + '<br>' + dol_nl2br(text2)
* text1 txt + text2 html => dol_nl2br(text1) + '<br>' + text2
* text1 txt + text2 txt => text1 + '\n' + text2
*
* @param string $text1 Text 1
* @param string $text2 Text 2
* @param bool $forxml false=Use <br>, true=Use <br />
* @return string Text 1 + new line + Text2
* @see dol_textishtml
*/
function dol_concatdesc($text1, $text2, $forxml = false)
{
$ret = '';
$ret .= !dol_textishtml($text1) && dol_textishtml($text2) ? dol_nl2br($text1, 0, $forxml) : $text1;
$ret .= !empty($text1) && !empty($text2) ? dol_textishtml($text1) || dol_textishtml($text2) ? $forxml ? "<br \\>\n" : "<br>\n" : "\n" : "";
$ret .= dol_textishtml($text1) && !dol_textishtml($text2) ? dol_nl2br($text2, 0, $forxml) : $text2;
return $ret;
}
示例5: FormMail
$email_from = '';
if (!empty($_POST["fromname"])) {
$email_from = $_POST["fromname"] . ' ';
}
if (!empty($_POST["frommail"])) {
$email_from .= '<' . $_POST["frommail"] . '>';
}
$errors_to = $_POST["errorstomail"];
$sendto = $_POST["sendto"];
$sendtocc = $_POST["sendtocc"];
$sendtoccc = $_POST["sendtoccc"];
$subject = $_POST['subject'];
$body = $_POST['message'];
$deliveryreceipt = $_POST["deliveryreceipt"];
//Check if we have to decode HTML
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401))) {
$body = dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401);
}
// Create form object
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$attachedfiles = $formmail->get_attached_files();
$filepath = $attachedfiles['paths'];
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
if (empty($_POST["frommail"])) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")), 'errors');
$action = 'test';
$error++;
}
if (empty($sendto)) {
示例6: pdf_getlinedesc
/**
* Return line description translated in outputlangs and encoded into htmlentities and with <br>
*
* @param Object $object Object
* @param int $i Current line number (0 = first line, 1 = second line, ...)
* @param Translate $outputlangs Object langs for output
* @param int $hideref Hide reference
* @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ?
* @return string String with line
*/
function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
{
global $db, $conf, $langs;
$idprod = !empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false;
$label = !empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '');
$desc = !empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '');
$ref_supplier = !empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '');
// TODO Not yet saved for supplier invoices, only supplier orders
$note = !empty($object->lines[$i]->note) ? $object->lines[$i]->note : '';
$dbatch = !empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false;
if ($issupplierline) {
$prodser = new ProductFournisseur($db);
} else {
$prodser = new Product($db);
}
if ($idprod) {
$prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated
if (!empty($conf->global->MAIN_MULTILANGS) && $outputlangs->defaultlang != $langs->defaultlang) {
$translatealsoifmodified = !empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED);
// By default if value was modified manually, we keep it (no translation because we don't have it)
// TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation
// ($textwasmodified is replaced with $textwasmodifiedorcompleted and we add completion).
// Set label
// If we want another language, and if label is same than default language (we did force it to a specific value), we can use translation.
//var_dump($outputlangs->defaultlang.' - '.$langs->defaultlang.' - '.$label.' - '.$prodser->label);exit;
$textwasmodified = $label == $prodser->label;
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasmodified || $translatealsoifmodified)) {
$label = $prodser->multilangs[$outputlangs->defaultlang]["label"];
}
// Set desc
// Manage HTML entities description test because $prodser->description is store with htmlentities but $desc no
$textwasmodified = false;
if (!empty($desc) && dol_textishtml($desc) && !empty($prodser->description) && dol_textishtml($prodser->description)) {
$textwasmodified = strpos(dol_html_entity_decode($desc, ENT_QUOTES | ENT_HTML401), dol_html_entity_decode($prodser->description, ENT_QUOTES | ENT_HTML401)) !== false;
} else {
$textwasmodified = $desc == $prodser->description;
}
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($textwasmodified || $translatealsoifmodified)) {
$desc = $prodser->multilangs[$outputlangs->defaultlang]["description"];
}
// Set note
$textwasmodified = $note == $prodser->note;
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) {
$note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
}
}
}
// Description short of product line
$libelleproduitservice = $label;
// Description long of product line
if (!empty($desc) && $desc != $label) {
if ($libelleproduitservice && empty($hidedesc)) {
$libelleproduitservice .= '__N__';
}
if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromCreditNote", $discount->ref_facture_source);
} elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $discount->ref_facture_source);
// Add date of deposit
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
echo ' (' . dol_print_date($discount->datec, 'day', '', $outputlangs) . ')';
}
} else {
if ($idprod) {
if (empty($hidedesc)) {
$libelleproduitservice .= $desc;
}
} else {
$libelleproduitservice .= $desc;
}
}
}
// If line linked to a product
if ($idprod) {
// We add ref
if ($prodser->ref) {
$prefix_prodserv = "";
$ref_prodserv = "";
if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) {
if ($prodser->isService()) {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service") . " ";
} else {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product") . " ";
}
//.........这里部分代码省略.........
示例7: get_form
//.........这里部分代码省略.........
if (!empty($this->withbody)) {
$defaultmessage = "";
// TODO A partir du type, proposer liste de messages dans table llx_c_email_template
if ($this->param["models"] == 'facture_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoice");
} elseif ($this->param["models"] == 'facture_relance') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoiceReminder");
} elseif ($this->param["models"] == 'propal_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendProposal");
} elseif ($this->param["models"] == 'order_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendOrder");
} elseif ($this->param["models"] == 'order_supplier_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierOrder");
} elseif ($this->param["models"] == 'invoice_supplier_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierInvoice");
} elseif ($this->param["models"] == 'shipping_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($this->param["models"] == 'fichinter_send') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentSendFichInter");
} elseif ($this->param["models"] == 'thirdparty') {
$defaultmessage = $langs->transnoentities("PredefinedMailContentThirdparty");
} elseif (!is_numeric($this->withbody)) {
$defaultmessage = $this->withbody;
}
// Complete substitution array
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) {
require_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
$langs->load('paypal');
if ($this->param["models"] == 'order_send') {
$url = getPaypalPaymentUrl(0, 'order', $this->substit['__ORDERREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
if ($this->param["models"] == 'facture_send') {
$url = getPaypalPaymentUrl(0, 'invoice', $this->substit['__FACREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
}
$defaultmessage = str_replace('\\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {
$this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']);
} else {
if (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) {
$defaultmessage = dol_nl2br($defaultmessage);
}
}
if (isset($_POST["message"])) {
$defaultmessage = $_POST["message"];
} else {
$defaultmessage = make_substitutions($defaultmessage, $this->substit);
// Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty)
$defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage);
$defaultmessage = preg_replace("/^\n+/", "", $defaultmessage);
}
$out .= '<tr>';
$out .= '<td width="180" valign="top">' . $langs->trans("MailText") . '</td>';
$out .= '<td>';
if ($this->withbodyreadonly) {
$out .= nl2br($defaultmessage);
$out .= '<input type="hidden" id="message" name="message" value="' . $defaultmessage . '" />';
} else {
if (!isset($this->ckeditortoolbar)) {
$this->ckeditortoolbar = 'dolibarr_notes';
}
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if ($this->withfckeditor == -1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$this->withfckeditor = 1;
} else {
$this->withfckeditor = 0;
}
}
$doleditor = new DolEditor('message', $defaultmessage, '', 280, $this->ckeditortoolbar, 'In', true, true, $this->withfckeditor, 8, 72);
$out .= $doleditor->Create(1);
}
$out .= "</td></tr>\n";
}
if ($this->withform == 1 || $this->withform == -1) {
$out .= '<tr><td align="center" colspan="2"><center>';
$out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="' . $langs->trans("SendMail") . '"';
// Add a javascript test to avoid to forget to submit file before sending email
if ($this->withfile == 2 && $conf->use_javascript_ajax) {
$out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\'' . dol_escape_js($langs->trans("FileWasNotUploaded")) . '\'); return false; } else { return true; }"';
}
$out .= ' />';
if ($this->withcancel) {
$out .= ' ';
$out .= '<input class="button" type="submit" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '" />';
}
$out .= '</center></td></tr>' . "\n";
}
$out .= '</table>' . "\n";
if ($this->withform == 1) {
$out .= '</form>' . "\n";
}
$out .= "<!-- Fin form mail -->\n";
return $out;
}
}
示例8: preg_replace
$sendto = $conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$from = $conf->global->MAILING_EMAIL_FROM;
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot . DOL_URL_ROOT;
// This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$urlback = $_SERVER["REQUEST_URI"];
$topic = '[' . $conf->global->MAIN_APPLICATION_TITLE . '] ' . $langs->transnoentitiesnoconv("ValidationOfPaypalPaymentFailed");
$content = "";
$content .= $langs->transnoentitiesnoconv("PaypalConfirmPaymentPageWasCalledButFailed") . "\n";
$content .= "\n";
$content .= $langs->transnoentitiesnoconv("TechnicalInformation") . ":\n";
$content .= $langs->transnoentitiesnoconv("ReturnURLAfterPayment") . ': ' . $urlback . "\n";
$content .= "tag=" . $fulltag . "\ntoken=" . $token . " paymentType=" . $paymentType . " currencycodeType=" . $currencyCodeType . " payerId=" . $payerID . " ipaddress=" . $ipaddress . " FinalPaymentAmt=" . $FinalPaymentAmt;
$ishtml = dol_textishtml($content);
// May contain urls
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
$result = $mailfile->sendfile();
if ($result) {
dol_syslog("EMail sent to " . $sendto, LOG_DEBUG, 0, '_paypal');
} else {
dol_syslog("Failed to send EMail to " . $sendto, LOG_ERR, 0, '_paypal');
}
}
}
} else {
dol_print_error('', 'Session expired');
}
} else {
示例9: envoi_mail
/**
* Send email
*
* @param string $mode Mode (test | confirm)
* @param string $oldemail Target email
* @param string $message Message to send
* @param string $total Total amount of unpayed invoices
* @param string $userlang Code lang to use for email output.
* @param string $oldtarget Target name
* @return int <0 if KO, >0 if OK
*/
function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
{
global $conf, $langs;
if (getenv('DOL_FORCE_EMAIL_TO')) {
$oldemail = getenv('DOL_FORCE_EMAIL_TO');
}
$newlangs = new Translate('', $conf);
$newlangs->setDefaultLang(empty($userlang) ? empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT : $userlang);
$newlangs->load("main");
$newlangs->load("bills");
$subject = empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_SUBJECT) ? $newlangs->trans("ListOfYourUnpaidInvoices") : $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_SUBJECT;
$sendto = $oldemail;
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
$msgishtml = -1;
print "- Send email to '" . $oldtarget . "' (" . $oldemail . "), total: " . $total . "\n";
dol_syslog("email_unpaid_invoices_to_customers.php: send mail to " . $oldemail);
$usehtml = 0;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
$usehtml += 1;
}
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER)) {
$usehtml += 1;
}
$allmessage = '';
if (!empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER;
} else {
$allmessage .= "Dear customer" . ($usehtml ? "<br>\n" : "\n") . ($usehtml ? "<br>\n" : "\n");
$allmessage .= "Please, find a summary of the bills with pending payments from you." . ($usehtml ? "<br>\n" : "\n") . ($usehtml ? "<br>\n" : "\n");
$allmessage .= "Note: This list contains only unpaid invoices." . ($usehtml ? "<br>\n" : "\n");
}
$allmessage .= $message . ($usehtml ? "<br>\n" : "\n");
$allmessage .= $langs->trans("Total") . " = " . price($total, 0, $userlang, 0, 0, -1, $conf->currency) . ($usehtml ? "<br>\n" : "\n");
if (!empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
$usehtml += 1;
}
}
$mail = new CMailFile($subject, $sendto, $from, $allmessage, array(), array(), array(), '', '', 0, $msgishtml);
$mail->errors_to = $errorsto;
// Send or not email
if ($mode == 'confirm') {
$result = $mail->sendfile();
if (!$result) {
print "Error sending email " . $mail->error . "\n";
dol_syslog("Error sending email " . $mail->error . "\n");
}
} else {
print "No email sent (test mode)\n";
dol_syslog("No email sent (test mode)");
$mail->dump_mail();
$result = 1;
}
unset($newlangs);
if ($result) {
return 1;
} else {
return -1;
}
}
示例10: dol_print_date
if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES)) {
$stringtoadd = dol_print_date(dol_now(), 'dayhour') . ' ' . $user->getFullName($langs) . ' --';
if (GETPOST('action') == 'edit' . $note_public) {
$value_public = dol_concatdesc($value_public, ($value_public ? "\n" : "") . "-- " . $stringtoadd);
if (dol_textishtml($value_public)) {
$value_public .= "<br>\n";
} else {
$value_public .= "\n";
}
}
}
if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) {
$stringtoadd = dol_print_date(dol_now(), 'dayhour') . ' ' . $user->getFullName($langs) . ' --';
if (GETPOST('action') == 'edit' . $note_private) {
$value_private = dol_concatdesc($value_private, ($value_private ? "\n" : "") . "-- " . $stringtoadd);
if (dol_textishtml($value_private)) {
$value_private .= "<br>\n";
} else {
$value_private .= "\n";
}
}
}
// Special cases
if ($module == 'propal') {
$permission = $user->rights->propale->creer;
} elseif ($module == 'fichinter') {
$permission = $user->rights->ficheinter->creer;
} elseif ($module == 'project') {
$permission = $user->rights->projet->creer;
} elseif ($module == 'project_task') {
$permission = $user->rights->projet->creer;
示例11: pdf_getlinedesc
//.........这里部分代码省略.........
$note = !empty($object->lines[$i]->note) ? $object->lines[$i]->note : '';
if ($issupplierline) {
$prodser = new ProductFournisseur($db);
} else {
$prodser = new Product($db);
}
if ($idprod) {
$prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated
if ($conf->global->MAIN_MULTILANGS && $outputlangs->defaultlang != $langs->defaultlang) {
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["libelle"]) && $label == $prodser->label) {
$label = $prodser->multilangs[$outputlangs->defaultlang]["libelle"];
}
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) {
$desc = $prodser->multilangs[$outputlangs->defaultlang]["description"];
}
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) {
$note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
}
}
}
// Description short of product line
$libelleproduitservice = $label;
// Description long of product line
if ($desc && $desc != $label) {
if ($libelleproduitservice && empty($hidedesc)) {
$libelleproduitservice .= '__N__';
}
if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromCreditNote", $discount->ref_facture_source);
} elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $discount->ref_facture_source);
// Add date of deposit
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
echo ' (' . dol_print_date($discount->datec, 'day', '', $outputlangs) . ')';
}
} else {
if ($idprod) {
if (empty($hidedesc)) {
$libelleproduitservice .= $desc;
}
} else {
$libelleproduitservice .= $desc;
}
}
}
// If line linked to a product
if ($idprod) {
// On ajoute la ref
if ($prodser->ref) {
$prefix_prodserv = "";
$ref_prodserv = "";
if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) {
if ($prodser->isservice()) {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service") . " ";
} else {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product") . " ";
}
}
if (empty($hideref)) {
if ($issupplierline) {
$ref_prodserv = $prodser->ref . ' (' . $outputlangs->transnoentitiesnoconv("SupplierRef") . ' ' . $ref_supplier . ')';
} else {
$ref_prodserv = $prodser->ref;
}
// Show local ref only
$ref_prodserv .= " - ";
}
$libelleproduitservice = $prefix_prodserv . $ref_prodserv . $libelleproduitservice;
}
}
if (!empty($object->lines[$i]->date_start) || !empty($object->lines[$i]->date_end)) {
$format = 'day';
// Show duration if exists
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end) {
$period = '(' . $outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs), dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)) . ')';
}
if ($object->lines[$i]->date_start && !$object->lines[$i]->date_end) {
$period = '(' . $outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs)) . ')';
}
if (!$object->lines[$i]->date_start && $object->lines[$i]->date_end) {
$period = '(' . $outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)) . ')';
}
//print '>'.$outputlangs->charset_output.','.$period;
$libelleproduitservice .= "__N__" . $period;
//print $libelleproduitservice;
}
// Now we convert \n into br
if (dol_textishtml($libelleproduitservice)) {
$libelleproduitservice = preg_replace('/__N__/', '<br>', $libelleproduitservice);
} else {
$libelleproduitservice = preg_replace('/__N__/', "\n", $libelleproduitservice);
}
$libelleproduitservice = dol_htmlentitiesbr($libelleproduitservice, 1);
return $libelleproduitservice;
}
示例12: testDolTextIsHtml
/**
* testDolTextIsHtml
*
* @return void
*/
public function testDolTextIsHtml()
{
// True
$input='<html>xxx</html>';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='<body>xxx</body>';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='xxx <b>yyy</b> zzz';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='xxx<br>';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='text with <div>some div</div>';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='text with HTML entities';
$after=dol_textishtml($input);
$this->assertTrue($after);
// False
$input='xxx < br>';
$after=dol_textishtml($input);
$this->assertFalse($after);
}
示例13: get_form
//.........这里部分代码省略.........
if ($this->withfile == 2) {
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="' . $langs->trans("Upload") . '" />';
$out .= ' ';
$out .= '<input type="submit" class="button" id="' . $addfileaction . '" name="' . $addfileaction . '" value="' . $langs->trans("MailingAddFile") . '" />';
}
} else {
$out .= $this->withfile;
}
$out .= "</td></tr>\n";
}
// Message
if (!empty($this->withbody)) {
$defaultmessage = "";
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) {
$defaultmessage = $arraydefaultmessage['content'];
} elseif (!is_numeric($this->withbody)) {
$defaultmessage = $this->withbody;
}
// Complete substitution array
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) {
require_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
$langs->load('paypal');
if ($this->param["models"] == 'order_send') {
$url = getPaypalPaymentUrl(0, 'order', $this->substit['__ORDERREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
if ($this->param["models"] == 'facture_send') {
$url = getPaypalPaymentUrl(0, 'invoice', $this->substit['__FACREF__']);
$this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
}
}
$defaultmessage = str_replace('\\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {
$this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']);
} else {
if (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) {
$defaultmessage = dol_nl2br($defaultmessage);
}
}
if (isset($_POST["message"]) && !$_POST['modelselected']) {
$defaultmessage = $_POST["message"];
} else {
$defaultmessage = make_substitutions($defaultmessage, $this->substit);
// Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty)
$defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage);
$defaultmessage = preg_replace("/^\n+/", "", $defaultmessage);
}
$out .= '<tr>';
$out .= '<td width="180" valign="top">' . $langs->trans("MailText") . '</td>';
$out .= '<td>';
if ($this->withbodyreadonly) {
$out .= nl2br($defaultmessage);
$out .= '<input type="hidden" id="message" name="message" value="' . $defaultmessage . '" />';
} else {
if (!isset($this->ckeditortoolbar)) {
$this->ckeditortoolbar = 'dolibarr_notes';
}
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if ($this->withfckeditor == -1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$this->withfckeditor = 1;
} else {
$this->withfckeditor = 0;
}
示例14: dol_escape_htmltag
print '<tr><td>';
$adresseadmin = $object->mail_admin;
print $langs->trans("Title") . '</td><td colspan="2">';
if ($action == 'edit') {
print '<input type="text" name="nouveautitre" style="width: 95%" value="' . dol_escape_htmltag(dol_htmlentities($object->titre)) . '">';
} else {
print dol_htmlentities($object->titre);
}
print '</td></tr>';
// Description
print '<tr><td class="tdtop">' . $langs->trans("Description") . '</td><td colspan="2">';
if ($action == 'edit') {
$doleditor = new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires), '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, 120);
$doleditor->Create(0, '');
} else {
print dol_textishtml($object->commentaires) ? $object->commentaires : dol_nl2br($object->commentaires, 1, true);
}
print '</td></tr>';
// EMail
//If linked user, then emails are going to be sent to users' email
if (!$object->fk_user_creat) {
print '<tr><td>' . $langs->trans("EMail") . '</td><td colspan="2">';
if ($action == 'edit') {
print '<input type="text" name="nouvelleadresse" size="40" value="' . $object->mail_admin . '">';
} else {
print dol_print_email($object->mail_admin, 0, 0, 1);
}
print '</td></tr>';
}
// Receive an email with each vote
print '<tr><td>' . $langs->trans('ToReceiveEMailForEachVote') . '</td><td colspan="2">';
示例15: GETPOST
$newlang = '';
if (empty($newlang) && GETPOST('lang_id')) {
$newlang = GETPOST('lang_id');
}
if (empty($newlang)) {
$newlang = $object->client->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = !empty($prod->multilangs[$outputlangs->defaultlang]["description"]) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
} else {
$desc = $prod->description;
}
$desc .= $desc && GETPOST('np_desc') ? dol_textishtml($desc) || dol_textishtml(GETPOST('np_desc')) ? "<br />\n" : "\n" : "";
$desc .= GETPOST('np_desc');
$type = $prod->type;
} else {
$pu_ht = GETPOST('np_price');
$tva_tx = str_replace('*', '', GETPOST('np_tva_tx'));
$tva_npr = preg_match('/\\*/', GETPOST('np_tva_tx')) ? 1 : 0;
$desc = GETPOST('dp_desc');
$type = GETPOST('type');
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->client);
$localtax2_tx = get_localtax($tva_tx, 2, $object->client);
$desc = dol_htmlcleanlastbr($desc);
// ajout prix achat
$fk_fournprice = GETPOST('np_fournprice');