本文整理汇总了PHP中Format::htmldecode方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::htmldecode方法的具体用法?PHP Format::htmldecode怎么用?PHP Format::htmldecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::htmldecode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: striptags
function striptags($var, $decode = true)
{
if (is_array($var)) {
return array_map(array('Format', 'striptags'), $var, array_fill(0, count($var), $decode));
}
return strip_tags($decode ? Format::htmldecode($var) : $var);
}
示例2: searchable
function searchable($value)
{
$value = preg_replace(array('`<br(\\s*)?/?>`i', '`</div>`i'), "\n", $value);
$value = Format::htmldecode(Format::striptags($value));
return Format::searchable($value);
}
示例3: send
function send($to, $subject, $message, $options = null)
{
global $ost;
//Get the goodies
require_once PEAR_DIR . 'Mail.php';
// PEAR Mail package
require_once PEAR_DIR . 'Mail/mime.php';
// PEAR Mail_Mime packge
//do some cleanup
$to = preg_replace("/(\r\n|\r|\n)/s", '', trim($to));
$subject = preg_replace("/(\r\n|\r|\n)/s", '', trim($subject));
//We're decoding html entities here becasuse we only support plain text for now - html support comming.
$body = Format::htmldecode(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
/* Message ID - generated for each outgoing email */
$messageId = sprintf('<%s%d-%s>', Misc::randCode(6), time(), $this->getEmail() ? $this->getEmail()->getEmail() : '@osTicketMailer');
$headers = array('From' => $this->getFromAddress(), 'To' => $to, 'Subject' => $subject, 'Date' => date('D, d M Y H:i:s O'), 'Message-ID' => $messageId, 'X-Mailer' => 'osTicket Mailer');
//Set bulk/auto-response headers.
if ($options && ($options['autoreply'] or $options['bulk'])) {
$headers += array('X-Autoreply' => 'yes', 'X-Auto-Response-Suppress' => 'ALL, AutoReply', 'Auto-Submitted' => 'auto-replied');
if ($options['bulk']) {
$headers += array('Precedence' => 'bulk');
} else {
$headers += array('Precedence' => 'auto_reply');
}
}
if ($options) {
if (isset($options['inreplyto']) && $options['inreplyto']) {
$headers += array('In-Reply-To' => $options['inreplyto']);
}
if (isset($options['references']) && $options['references']) {
if (is_array($options['references'])) {
$headers += array('References' => implode(' ', $options['references']));
} else {
$headers += array('References' => $options['references']);
}
}
}
$mime = new Mail_mime();
$mime->setTXTBody($body);
//XXX: Attachments
if ($attachments = $this->getAttachments()) {
foreach ($attachments as $attachment) {
if ($attachment['file_id'] && ($file = AttachmentFile::lookup($attachment['file_id']))) {
$mime->addAttachment($file->getData(), $file->getType(), $file->getName(), false);
} elseif ($attachment['file'] && file_exists($attachment['file']) && is_readable($attachment['file'])) {
$mime->addAttachment($attachment['file'], $attachment['type'], $attachment['name']);
}
}
}
//Desired encodings...
$encodings = array('head_encoding' => 'quoted-printable', 'text_encoding' => 'base64', 'html_encoding' => 'base64', 'html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'head_charset' => 'utf-8');
//encode the body
$body = $mime->get($encodings);
//encode the headers.
$headers = $mime->headers($headers, true);
if ($smtp = $this->getSMTPInfo()) {
//Send via SMTP
$mail = mail::factory('smtp', array('host' => $smtp['host'], 'port' => $smtp['port'], 'auth' => $smtp['auth'], 'username' => $smtp['username'], 'password' => $smtp['password'], 'timeout' => 20, 'debug' => false));
$result = $mail->send($to, $headers, $body);
if (!PEAR::isError($result)) {
return $messageId;
}
$alert = sprintf("Unable to email via SMTP:%s:%d [%s]\n\n%s\n", $smtp['host'], $smtp['port'], $smtp['username'], $result->getMessage());
$this->logError($alert);
}
//No SMTP or it failed....use php's native mail function.
$mail = mail::factory('mail');
return PEAR::isError($mail->send($to, $headers, $body)) ? false : $messageId;
}
示例4: getSearchable
function getSearchable()
{
// <br> -> \n
$body = preg_replace(array('`<br(\\s*)?/?>`i', '`</div>`i'), "\n", $this->body);
$body = Format::htmldecode(Format::striptags($body));
return Format::searchable($body);
}
示例5: fromVars
static function fromVars($vars)
{
// Try and lookup by email address
$user = static::lookupByEmail($vars['email']);
if (!$user) {
$name = $vars['name'];
if (!$name) {
list($name) = explode('@', $vars['email'], 2);
}
$user = User::create(array('name' => Format::htmldecode(Format::sanitize($name, false)), 'created' => new SqlFunction('NOW'), 'updated' => new SqlFunction('NOW'), 'default_email' => UserEmail::ensure($vars['email'])));
// Is there an organization registered for this domain
list($mailbox, $domain) = explode('@', $vars['email'], 2);
if (isset($vars['org_id'])) {
$user->set('org_id', $vars['org_id']);
} elseif ($org = Organization::forDomain($domain)) {
$user->setOrganization($org, false);
}
try {
$user->save(true);
$user->emails->add($user->default_email);
// Attach initial custom fields
$user->addDynamicData($vars);
} catch (OrmException $e) {
return null;
}
}
return $user;
}
示例6: fromVars
static function fromVars($vars, $update = false)
{
// Try and lookup by email address
$user = static::lookupByEmail($vars['email']);
if (!$user) {
$name = $vars['name'];
if (!$name) {
list($name) = explode('@', $vars['email'], 2);
}
$user = User::create(array('name' => Format::htmldecode(Format::sanitize($name, false)), 'created' => new SqlFunction('NOW'), 'updated' => new SqlFunction('NOW'), 'default_email' => UserEmail::ensure($vars['email'])));
// Is there an organization registered for this domain
list($mailbox, $domain) = explode('@', $vars['email'], 2);
if (isset($vars['org_id'])) {
$user->set('org_id', $vars['org_id']);
} elseif ($org = Organization::forDomain($domain)) {
$user->setOrganization($org, false);
}
try {
$user->save(true);
$user->emails->add($user->default_email);
// Attach initial custom fields
$user->addDynamicData($vars);
} catch (OrmException $e) {
return null;
}
} elseif ($update) {
$errors = array();
$user->updateInfo($vars, $errors, true);
}
/* INICIO
Anthony Parisi
*/
if (isset($_SESSION["crmEmail"])) {
$mysqli = new mysqli("localhost", "root", "ip15x0", "vtigercrm600");
$sqlUser = $mysqli->query("SELECT MAX(id) FROM `vtigercrm600`.vtiger_modtracker_detail;");
$resUser = $sqlUser->fetch_array();
$mysqli->query("UPDATE `vtigercrm600`.`vtiger_contactdetails` SET `mobile` = '" . $_SESSION["crmPhone"] . "' WHERE UPPER(`vtiger_contactdetails`.`email`) = UPPER('" . $_SESSION["crmEmail"] . "');");
$mysqli->query("INSERT INTO `vtigercrm600`.vtiger_modtracker_detail(id,fieldname,prevalue,postvalue) VALUES('" . $resUser[0] . "','email',NULL,'" . $_SESSION["crmPhone"] . "');");
unset($_SESSION["crmEmail"]);
unset($_SESSION["crmPhone"]);
}
/* FIN */
return $user;
}