本文整理汇总了PHP中html2text函数的典型用法代码示例。如果您正苦于以下问题:PHP html2text函数的具体用法?PHP html2text怎么用?PHP html2text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html2text函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: CoOnePage
/**
* 获取一个页面
*
* @access public
* @param string $gurl 操作地址
* @return string
*/
function CoOnePage($gurl)
{
global $dsql, $cfg_auot_description, $cfg_soft_lang;
$redatas = array('title' => '', 'body' => '', 'source' => '', 'writer' => '', 'description' => '', 'keywords' => '');
$redatas['source'] = preg_replace("/http:\\/\\//i", "", $gurl);
$redatas['source'] = preg_replace("/\\/(.*)\$/i", "", $redatas['source']);
$row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '" . $redatas['source'] . "' ");
$s = $e = '';
if (is_array($row)) {
list($s, $e) = explode('{@body}', $row['rule']);
$s = trim($s);
$e = trim($e);
if ($row['issource'] == 1) {
$redatas['source'] = $row['title'];
}
}
$htd = new DedeHttpDown();
$htd->OpenUrl($gurl);
$body = $htd->GetHtml();
if ($body != '') {
//编码自动转换
if ($cfg_soft_lang == 'utf-8') {
if ($row['lang'] == 'gb2312') {
$body = gb2utf8($body);
}
} else {
if ($cfg_soft_lang == 'gb2312') {
if ($row['lang'] == 'utf-8') {
$body = utf82gb($body);
}
}
}
//获取标题
$inarr = array();
preg_match("/<title>(.*)<\\/title>/isU", $body, $inarr);
if (isset($inarr[1])) {
$redatas['title'] = $inarr[1];
}
//获取关键词
$inarr = array();
preg_match("/<meta[\\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
if (isset($inarr[1])) {
$redatas['keywords'] = cn_substr(html2text($inarr[1]), 30);
}
//获取摘要
$inarr = array();
preg_match("/<meta[\\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
if (isset($inarr[1])) {
$redatas['description'] = cn_substr(html2text($inarr[1]), $cfg_auot_description);
}
//获取内容
if ($s != '' && $e != '') {
$redatas['body'] = GetHtmlAreaA($s, $e, $body);
if ($redatas['body'] != '' && $redatas['description'] == '') {
$redatas['description'] = cn_substr(html2text($redatas['body']), $GLOBALS['cfg_auot_description']);
}
}
}
return $redatas;
}
开发者ID:hensonvip,项目名称:ymroad,代码行数:67,代码来源:inc_coonepage.php
示例2: text_preview
/**
* shorten text for preview
*
* @param string $text
* input text
* @param integer $lenght
* @param integer $tolerance
* how much additional lenght is acceptable
* @return string shortend string
*/
function text_preview($text, $lenght, $tolerance)
{
$text = str_replace("<p", " <p", $text);
$text = str_replace("<div", " <div", $text);
$text = html2text($text);
// remove HTML
$text = substr($text, 0, $lenght + $tolerance + 20);
// shorten to improve runtime
if (strlen($text) < $lenght) {
// if the text is to short, directly export it.
return $text;
}
$separators = array(".", ",", " ");
foreach ($separators as $separator) {
$array = explode($separator, $text);
$preview = "";
$j = 0;
do {
// add parts (sentences/words) until it is longer as $length
$preview .= $array[$j] . $separator;
$j += 1;
} while (strlen($preview) < $lenght);
if (strlen($preview) < $lenght + $tolerance) {
// If the length is within the tolerance range, exit.
// If not try again with a different separator.
return $preview;
}
}
return substr($text, 0, $lenght);
// if it doesn't work, make a hard cut
}
开发者ID:Findus23,项目名称:php-functions,代码行数:41,代码来源:functions.php
示例3: GetOneArchive
function GetOneArchive($aid)
{
global $dsql;
include_once DEDEINC . "/channelunit.func.php";
$aid = trim(preg_replace('/[^0-9]/', '', $aid));
$reArr = array();
$chRow = $dsql->GetOne("SELECT arc.*,ch.maintable,ch.addtable,ch.issystem FROM `#@__arctiny` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel WHERE arc.id='{$aid}' ");
if (!is_array($chRow)) {
return $reArr;
} else {
if (empty($chRow['maintable'])) {
$chRow['maintable'] = '#@__archives';
}
}
if ($chRow['issystem'] != -1) {
$nquery = " SELECT arc.*,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath\n FROM `{$chRow['maintable']}` arc LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid\n WHERE arc.id='{$aid}' ";
} else {
$nquery = " SELECT arc.*,1 AS ismake,0 AS money,'' AS filename,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath\n FROM `{$chRow['addtable']}` arc LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid\n WHERE arc.aid='{$aid}' ";
}
$arcRow = $dsql->GetOne($nquery);
if (!is_array($arcRow)) {
return $reArr;
}
if (!isset($arcRow['description'])) {
$arcRow['description'] = '';
}
if (empty($arcRow['description']) && isset($arcRow['body'])) {
$arcRow['description'] = cn_substr(html2text($arcRow['body']), 250);
}
if (!isset($arcRow['pubdate'])) {
$arcRow['pubdate'] = $arcRow['senddate'];
}
if (!isset($arcRow['notpost'])) {
$arcRow['notpost'] = 0;
}
$reArr = $arcRow;
$reArr['aid'] = $aid;
$reArr['topid'] = $arcRow['topid'];
$reArr['arctitle'] = $arcRow['title'];
$reArr['arcurl'] = GetFileUrl($aid, $arcRow['typeid'], $arcRow['senddate'], $reArr['title'], $arcRow['ismake'], $arcRow['arcrank'], $arcRow['namerule'], $arcRow['typedir'], $arcRow['money'], $arcRow['filename'], $arcRow['moresite'], $arcRow['siteurl'], $arcRow['sitepath']);
return $reArr;
}
开发者ID:hensonvip,项目名称:ymroad,代码行数:42,代码来源:archive.helper.php
示例4: ellipsize_html
Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_ANNOUNCEMENT, $id);
$txt_content = ellipsize_html(canonicalize_whitespace(strip_tags($_POST['newContent'])), 50, '+');
Log::record($course_id, MODULE_ID_ANNOUNCE, $log_type, array('id' => $id, 'email' => $send_mail, 'title' => $_POST['antitle'], 'content' => $txt_content));
// send email
if ($send_mail) {
$recipients_emaillist = "";
foreach ($_POST['recipients'] as $re) {
$recipients_emaillist .= empty($recipients_emaillist) ? "'{$re}'" : ",'{$re}'";
}
$emailContent = "{$professorMessage}: " . q($_SESSION['givenname']) . " " . q($_SESSION['surname']) . "<br>\n<br>\n" . q($_POST['antitle']) . "<br>\n<br>\n" . $_POST['newContent'];
$emailSubject = "{$professorMessage} ({$public_code} - " . q($title) . " - {$langAnnouncement})";
// select students email list
$countEmail = 0;
$invalid = 0;
$recipients = array();
$emailBody = html2text($emailContent);
$linkhere = " <a href='{$urlServer}main/profile/emailunsubscribe.php?cid={$course_id}'>{$langHere}</a>.";
$unsubscribe = "<br /><br />{$langNote}: " . sprintf($langLinkUnsubscribe, $title);
$emailContent .= $unsubscribe . $linkhere;
$general_to = 'Members of course ' . $course_code;
Database::get()->queryFunc("SELECT course_user.user_id as id, user.email as email\n FROM course_user, user\n WHERE course_id = ?d AND user.id IN ({$recipients_emaillist}) AND \n course_user.user_id = user.id", function ($person) use(&$countEmail, &$recipients, &$invalid, $course_id, $general_to, $emailSubject, $emailBody, $emailContent, $charset) {
$countEmail++;
$emailTo = $person->email;
$user_id = $person->id;
// check email syntax validity
if (!email_seems_valid($emailTo)) {
$invalid++;
} elseif (get_user_email_notification($user_id, $course_id)) {
// checks if user is notified by email
array_push($recipients, $emailTo);
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:index.php
示例5: ParseDMFields
/**
* 解析模板,对内容里的变动进行赋值
*
* @access public
* @param string $pageNo 页码数
* @param string $ismake 是否生成
* @return string
*/
function ParseDMFields($pageNo, $ismake = 1)
{
$this->NowPage = $pageNo;
$this->Fields['nowpage'] = $this->NowPage;
if ($this->SplitPageField != '' && isset($this->Fields[$this->SplitPageField])) {
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];
if ($pageNo > 1) {
$this->Fields['description'] = trim(preg_replace("/[\r\n\t]/", ' ', cn_substr(html2text($this->Fields[$this->SplitPageField]), 200)));
}
}
//解析模板
if (is_array($this->dtp->CTags)) {
foreach ($this->dtp->CTags as $i => $ctag) {
if ($ctag->GetName() == 'field') {
$this->dtp->Assign($i, $this->GetField($ctag->GetAtt('name'), $ctag));
} else {
if ($ctag->GetName() == 'pagebreak') {
if ($ismake == 0) {
$this->dtp->Assign($i, $this->GetPagebreakDM($this->TotalPage, $this->NowPage, $this->ArcID));
} else {
$this->dtp->Assign($i, $this->GetPagebreak($this->TotalPage, $this->NowPage, $this->ArcID));
}
} else {
if ($ctag->GetName() == 'pagetitle') {
if ($ismake == 0) {
$this->dtp->Assign($i, $this->GetPageTitlesDM($ctag->GetAtt("style"), $pageNo));
} else {
$this->dtp->Assign($i, $this->GetPageTitlesST($ctag->GetAtt("style"), $pageNo));
}
} else {
if ($ctag->GetName() == 'prenext') {
$this->dtp->Assign($i, $this->GetPreNext($ctag->GetAtt('get')));
} else {
if ($ctag->GetName() == 'fieldlist') {
$innertext = trim($ctag->GetInnerText());
if ($innertext == '') {
$innertext = GetSysTemplets('tag_fieldlist.htm');
}
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace('field', '[', ']');
$dtp2->LoadSource($innertext);
$oldSource = $dtp2->SourceString;
$oldCtags = $dtp2->CTags;
$res = '';
if (is_array($this->ChannelUnit->ChannelFields) && is_array($dtp2->CTags)) {
foreach ($this->ChannelUnit->ChannelFields as $k => $v) {
if (isset($v['autofield']) && empty($v['autofield'])) {
continue;
}
$dtp2->SourceString = $oldSource;
$dtp2->CTags = $oldCtags;
$fname = $v['itemname'];
foreach ($dtp2->CTags as $tid => $ctag2) {
if ($ctag2->GetName() == 'name') {
$dtp2->Assign($tid, $fname);
} else {
if ($ctag2->GetName() == 'tagname') {
$dtp2->Assign($tid, $k);
} else {
if ($ctag2->GetName() == 'value') {
$this->Fields[$k] = $this->ChannelUnit->MakeField($k, $this->Fields[$k], $ctag2);
@$dtp2->Assign($tid, $this->Fields[$k]);
}
}
}
}
$res .= $dtp2->GetResult();
}
}
$this->dtp->Assign($i, $res);
}
}
}
}
}
//end case
}
//结束模板循环
}
}
开发者ID:nomagame,项目名称:HNJC-Official-Website,代码行数:88,代码来源:arc.archives.class.php
示例6: getBodyTextRendered
/**
* Replaces the placeholders with the content and returns
* the rendered text if a text was set with "$mail->setBodyText()" *
* @return string
*/
public function getBodyTextRendered()
{
$text = $this->getBodyText();
//if the content was manually set with $obj->setBodyText(); this content will be used
if ($text instanceof Zend_Mime_Part) {
$rawText = $text->getRawContent();
$content = $this->placeholderObject->replacePlaceholders($rawText, $this->getParams(), $this->getDocument(), $this->getEnableLayoutOnPlaceholderRendering());
} else {
//creating text version from html email if html2text is installed
try {
include_once "simple_html_dom.php";
include_once "html2text.php";
$htmlContent = $this->getBodyHtmlRendered();
$html = str_get_html($htmlContent);
if ($html) {
$body = $html->find("body", 0);
if ($body) {
$htmlContent = $body->innertext;
}
}
$content = @html2text($htmlContent);
} catch (Exception $e) {
Logger::err($e);
$content = "";
}
}
return $content;
}
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:33,代码来源:Mail.php
示例7: cn_substr
$endtime = $senddate + 3600 * 24 * $endtime;
$title = cn_substr($title,80);
if($keywords!="") $keywords = trim(cn_substr($keywords,60))." ";
//处理上传的缩略图
if(empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none',$picname,$ddisremote);
$body = stripslashes($body);
//自动摘要
if($description=="" && $cfg_auot_description>0){
$description = stripslashes(cn_substr(html2text($body),$cfg_auot_description));
$description = trim(preg_replace("/#p#|#e#/","",$description));
$description = addslashes($description);
}
//把内容中远程的图片资源本地化
//------------------------------------
if($cfg_isUrlOpen && $remote==1){
$body = GetCurContent($body);
}
//自动获取关键字
//----------------------------------
if($autokey==1){
require_once(DEDEADMIN."/../include/pub_splitword_www.php");
$keywords = "";
$sp = new SplitWord();
$titleindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM($title))));
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:info_edit_action.php
示例8: get_less_variables
function get_less_variables()
{
$less_options = array();
global $get_less_variables_entry, $get_less_variables_data;
if ($get_less_variables_entry) {
return $get_less_variables_data;
}
@($file_pointer = fopen(file_require(get_template_directory() . "/assets/less/variables.less"), "r"));
if ($file_pointer) {
while (!feof($file_pointer)) {
$line = fgets($file_pointer, 999);
$line = trim($line . '');
if (substr($line, 0, 2) != "//" && strlen($line) > 3 && substr($line, 0, 1) == "@") {
$splits = explode(':', $line);
$variable = trim(str_replace('@', '', $splits[0]));
$value = trim($splits[1]);
if (strpos($value, '//') !== false) {
$pos = explode('//', $value);
$value = trim($pos[0]);
}
$value = str_replace(';', '', $value);
$less_options[] = array('variable' => $variable, 'value' => $value);
} else {
if (substr($line, 0, 4) == '//**') {
$variable = 'less-heading';
$value = str_replace('//**', '', $line);
$less_options[] = array('variable' => $variable, 'value' => html2text($value));
}
}
}
fclose($file_pointer);
}
$get_less_variables_entry = true;
$get_less_variables_data = $less_options;
return $less_options;
}
开发者ID:petersondrs,项目名称:tellura,代码行数:36,代码来源:index.php
示例9: olc_db_query
// ok lets send the mails in packages of 30 mails, to prevent php timeout
$count = $limit_data['count'];
$finished = $count <= $limit_high;
if ($finished) {
$limit_high = $count;
}
$max_runtime = $limit_high - $limit_low;
$newsletters_query = olc_db_query("SELECT\n title,\n body,\n bc,\n cc\n FROM " . TABLE_MODULE_NEWSLETTER . "\n WHERE newsletter_id='" . $id_get . APOS);
$newsletters_data = olc_db_fetch_array($newsletters_query);
$newsletters_title = $newsletters_data['title'];
$newsletters_body_html = $newsletters_data['body'];
$newsletters_body_text = html2text($newsletters_body_html);
$newsletter_impressum_file = DIR_FS_CATALOG . "lang" . SLASH . SESSION_LANGUAGE . SLASH . "impressum" . HTML_EXT;
if (is_file($newsletter_impressum_file)) {
$newsletter_impressum_html = file_get_contents($newsletter_impressum_file);
$newsletter_impressum_text = html2text($newsletter_impressum_html);
}
$remove_url0 = HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FILENAME_CATALOG_NEWSLETTER . '?action=remove&x=true&email=';
$two_nl = chr(10) . chr(10);
$link_start = $two_nl . TEXT_NEWSLETTER_REMOVE_LINK . $two_nl . '#' . $remove_url0;
$link_start_text = str_replace(HASH, EMPTY_STRING, $link_start);
$link_start_html = str_replace(HASH, HTML_A_START, $link_start);
$link_end_html = '">' . TEXT_NEWSLETTER_REMOVE . HTML_A_END . $two_nl . '(' . $remove_url0;
$sql_update = SQL_UPDATE . $temp_table . " SET comment='send' WHERE id='";
for ($i = 1; $i <= $max_runtime; $i++) {
// mail
$i1 = $i - 1;
$current_email_data = $email_data[$i1];
$email = $current_email_data['email'];
$s = $email . '&key=' . $current_email_data['key'];
$link_text = $link_start_text . $s;
开发者ID:BackupTheBerlios,项目名称:ol-commerce-svn,代码行数:31,代码来源:module_newsletter.php
示例10: __construct
public function __construct($data, $cron = false)
{
parent::__construct($data, $cron);
$post = get_record_sql('
SELECT
p.subject, p.body, p.poster, p.parent, ' . db_format_tsfield('p.ctime', 'ctime') . ',
t.id AS topicid, fp.subject AS topicsubject, f.title AS forumtitle, g.id AS groupid, g.name AS groupname, f.id AS forumid
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t ON (t.id = p.topic AND t.deleted = 0)
INNER JOIN {interaction_forum_post} fp ON (fp.parent IS NULL AND fp.topic = t.id)
INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted = 0)
INNER JOIN {group} g ON (f.group = g.id AND g.deleted = 0)
WHERE p.id = ? AND p.deleted = 0', array($this->postid));
// The post may have been deleted during the activity delay
if (!$post) {
$this->users = array();
return;
}
// Set notification to site admins.
$siteadmins = activity_get_users($this->get_id(), null, null, true);
// Get forum moderators and admins.
$forumadminsandmoderators = activity_get_users($this->get_id(), array_merge(get_forum_moderators($post->forumid), group_get_admin_ids($post->groupid)));
// Populate users to notify list and get rid of duplicates.
foreach (array_merge($siteadmins, $forumadminsandmoderators) as $user) {
if (!isset($this->users[$user->id])) {
$this->users[$user->id] = $user;
}
}
// Record who reported it.
$this->fromuser = $this->reporter;
$post->posttime = strftime(get_string('strftimedaydatetime'), $post->ctime);
$post->textbody = trim(html2text($post->body));
$post->htmlbody = clean_html($post->body);
$this->url = 'interaction/forum/topic.php?id=' . $post->topicid . '&post=' . $this->postid . '&objection=1';
$this->add_urltext(array('key' => 'Topic', 'section' => 'interaction.forum'));
if ($this->event === REPORT_OBJECTIONABLE) {
$this->overridemessagecontents = true;
$this->strings->subject = (object) array('key' => 'objectionablecontentpost', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter)));
} else {
if ($this->event === MAKE_NOT_OBJECTIONABLE) {
$this->strings = (object) array('subject' => (object) array('key' => 'postnotobjectionablesubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'postnotobjectionablebody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster))));
} else {
if ($this->event === DELETE_OBJECTIONABLE_POST) {
$this->url = '';
$this->strings = (object) array('subject' => (object) array('key' => 'objectionablepostdeletedsubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'objectionablepostdeletedbody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster), $post->textbody)));
} else {
if ($this->event === DELETE_OBJECTIONABLE_TOPIC) {
$this->url = '';
$this->strings = (object) array('subject' => (object) array('key' => 'objectionabletopicdeletedsubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'objectionabletopicdeletedbody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster), $post->textbody)));
} else {
throw new SystemException();
}
}
}
}
$this->temp = (object) array('post' => $post);
}
开发者ID:vohung96,项目名称:mahara,代码行数:57,代码来源:lib.php
示例11: sprintf
</div>
";
$emailfooter = "
<!-- Footer Section -->
<div id='mail-footer'>
<br>
<div>
<small>" . sprintf($langLinkUnsubscribeFromPlatform, $siteName) ." <a href='${urlServer}main/profile/emailunsubscribe.php?cid=$course_id'>$langHere</a></small>
</div>
</div>
";
$emailcontent = $emailheader.$emailmain.$emailfooter;
$emailbody = html2text($emailcontent);
if (count($recipients) >= 50) {
send_mail_multipart('', '', '', $recipients, $emailsubject, $emailbody, $emailcontent, $charset);
$recipients = array();
}
}
if (count($recipients) > 0) {
send_mail_multipart('', '', '', $recipients, $emailsubject, $emailbody, $emailcontent, $charset);
}
// Display result and close table correctly
$tool_content .= "<div class='alert alert-success'>$emailsuccess</div>";
} else {
$body_mail = $email_title = '';
// Display form to administrator
$tool_content .= "<div class='form-wrapper'>
<form class='form-horizontal' role='form' action='$_SERVER[SCRIPT_NAME]' method='post'>
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:mailtoprof.php
示例12: __construct
public function __construct($data)
{
parent::__construct($data);
$this->overridemessagecontents = true;
$post = get_record_sql('
SELECT
p.subject, p.body, p.poster, p.parent, ' . db_format_tsfield('p.ctime', 'ctime') . ',
t.id AS topicid, fp.subject AS topicsubject, f.title AS forumtitle, g.name AS groupname, f.id AS forumid
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t ON (t.id = p.topic AND t.deleted = 0)
INNER JOIN {interaction_forum_post} fp ON (fp.parent IS NULL AND fp.topic = t.id)
INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted = 0)
INNER JOIN {group} g ON (f.group = g.id AND g.deleted = 0)
WHERE p.id = ? AND p.deleted = 0', array($this->postid));
// The post may have been deleted during the activity delay
if (!$post) {
$this->users = array();
return;
}
$subscribers = get_records_sql_assoc('
SELECT "user" AS subscriber, \'topic\' AS type, "key" FROM {interaction_forum_subscription_topic} WHERE topic = ?
UNION
SELECT "user" AS subscriber, \'forum\' AS type, "key" FROM {interaction_forum_subscription_forum} WHERE forum = ?
ORDER BY type', array($post->topicid, $post->forumid));
$this->users = $subscribers ? activity_get_users($this->get_id(), array_keys($subscribers)) : array();
$this->fromuser = $post->poster;
// When emailing forum posts, create Message-Id headers for threaded display by email clients
$urlinfo = parse_url(get_config('wwwroot'));
$hostname = $urlinfo['host'];
$cleanforumname = str_replace('"', "'", strip_tags($post->forumtitle));
$this->customheaders = array('List-Id: "' . $cleanforumname . '" <forum' . $post->forumid . '@' . $hostname . '>', 'List-Help: ' . get_config('wwwroot') . 'interaction/forum/view.php?id=' . $post->forumid, 'Message-ID: <forumpost' . $this->postid . '@' . $hostname . '>');
if ($post->parent) {
$this->customheaders[] = 'In-Reply-To: <forumpost' . $post->parent . '@' . $hostname . '>';
$this->customheaders[] = 'References: <forumpost' . $post->parent . '@' . $hostname . '>';
}
$posttime = strftime(get_string('strftimedaydatetime'), $post->ctime);
$htmlbody = $post->body;
$this->message = strip_tags(str_shorten_html($htmlbody, 200, true));
// For internal notifications.
$textbody = trim(html2text($post->body));
$postlink = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $post->topicid . '#post' . $this->postid;
$this->url = $postlink;
$this->add_urltext(array('key' => 'Topic', 'section' => 'interaction.forum'));
foreach ($this->users as &$user) {
$lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
if ($post->parent) {
$user->subject = get_string_from_language($lang, 'replyforumpostnotificationsubject', 'interaction.forum', $post->groupname, $post->forumtitle, $post->topicsubject);
} else {
$user->subject = get_string_from_language($lang, 'newforumpostnotificationsubject', 'interaction.forum', $post->groupname, $post->forumtitle, $post->subject);
}
$type = $subscribers[$user->id]->type;
$unsubscribeid = $post->{$type . 'id'};
$unsubscribelink = get_config('wwwroot') . 'interaction/forum/unsubscribe.php?' . $type . '=' . $unsubscribeid . '&key=' . $subscribers[$user->id]->key;
$user->emailmessage = get_string_from_language($lang, 'forumposttemplate', 'interaction.forum', $post->subject ? $post->subject : get_string_from_language($lang, 're', 'interaction.forum', $post->topicsubject), display_name($post->poster, $user), $posttime, $textbody, $postlink, $type, $unsubscribelink);
$user->htmlmessage = get_string_from_language($lang, 'forumposthtmltemplate', 'interaction.forum', $post->subject ? $post->subject : get_string_from_language($lang, 're', 'interaction.forum', $post->topicsubject), display_name($post->poster, $user), $posttime, $htmlbody, $postlink, $unsubscribelink, $type);
}
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:57,代码来源:lib.php
示例13: __construct
/**
* @param array $data Parameters:
* - viewid (int)
* - commentid (int)
*/
public function __construct($data, $cron = false)
{
parent::__construct($data, $cron);
$comment = new ArtefactTypeComment($this->commentid);
$this->overridemessagecontents = true;
if ($onartefact = $comment->get('onartefact')) {
// feedback on artefact
$userid = null;
require_once get_config('docroot') . 'artefact/lib.php';
$artefactinstance = artefact_instance_from_id($onartefact);
if ($artefactinstance->feedback_notify_owner()) {
$userid = $artefactinstance->get('owner');
}
if (empty($this->url)) {
$this->url = get_config('wwwroot') . 'view/artefact.php?artefact=' . $onartefact . '&view=' . $this->viewid;
}
} else {
// feedback on view.
$onview = $comment->get('onview');
if (!($viewrecord = get_record('view', 'id', $onview))) {
throw new ViewNotFoundException(get_string('viewnotfound', 'error', $onview));
}
$userid = $viewrecord->owner;
if (empty($this->url)) {
$this->url = get_config('wwwroot') . 'view/view.php?id=' . $onview;
}
}
if (empty($userid)) {
return;
}
$this->users = activity_get_users($this->get_id(), array($userid));
$title = $onartefact ? $artefactinstance->get('title') : $viewrecord->title;
$this->urltext = $title;
$body = $comment->get('description');
$posttime = strftime(get_string('strftimedaydatetime'), $comment->get('ctime'));
$user = $this->users[0];
$lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
// Internal
$this->message = strip_tags(str_shorten_html($body, 200, true));
// Comment deleted notification
if ($deletedby = $comment->get('deletedby')) {
$this->strings = (object) array('subject' => (object) array('key' => 'commentdeletednotificationsubject', 'section' => 'artefact.comment', 'args' => array($title)));
$deletedmessage = ArtefactTypeComment::deleted_messages();
$removedbyline = get_string_from_language($lang, $deletedmessage[$deletedby], 'artefact.comment');
$this->message = $removedbyline . ":\n" . $this->message;
// Email
$this->users[0]->htmlmessage = get_string_from_language($lang, 'feedbackdeletedhtml', 'artefact.comment', $title, $removedbyline, $body, $this->url, $title);
$this->users[0]->emailmessage = get_string_from_language($lang, 'feedbackdeletedtext', 'artefact.comment', $title, $removedbyline, trim(html2text($body)), $title, $this->url);
return;
}
$this->strings = (object) array('subject' => (object) array('key' => 'newfeedbacknotificationsubject', 'section' => 'artefact.comment', 'args' => array($title)));
$this->url .= '&showcomment=' . $comment->get('id');
// Email
$author = $comment->get('author');
$authorname = empty($author) ? $comment->get('authorname') : display_name($author, $user);
$this->users[0]->htmlmessage = get_string_from_language($lang, 'feedbacknotificationhtml', 'artefact.comment', $authorname, $title, $posttime, $body, $this->url);
$this->users[0]->emailmessage = get_string_from_language($lang, 'feedbacknotificationtext', 'artefact.comment', $authorname, $title, $posttime, trim(html2text($body)), $this->url);
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:63,代码来源:lib.php
示例14: html2Text
/**
* generates text version of htmlContent
* uses html2text binary if it was successfully enabled by calling
* enableHtml2textBinary(), otherwise it uses html2text php version
* @returns string
*/
protected function html2Text($htmlContent)
{
if ($this->getHtml2TextBinaryEnabled()) {
$content = "";
//html2text doesn't support unicode
if ($this->getCharset() == "UTF-8") {
$htmlContent = utf8_decode($htmlContent);
}
//using temporary file so we don't have problems with special characters
$tmpFileName = PIMCORE_TEMPORARY_DIRECTORY . "/" . uniqid('email_', true) . ".tmp";
if (\Pimcore\File::put($tmpFileName, $htmlContent)) {
$content = @shell_exec("html2text {$tmpFileName} " . $this->getHtml2TextOptions());
@unlink($tmpFileName);
}
return $content;
} else {
return @html2text($htmlContent);
}
}
开发者ID:GNi33,项目名称:pimcore,代码行数:25,代码来源:Mail.php
示例15: locoyspider_addcompany
function locoyspider_addcompany($companyname)
{
global $locoyspider, $db;
$setsqlarr['uid'] = locoyspider_user_register(check_email(trim($_POST['email'])));
if ($setsqlarr['uid'] == "") {
exit("添加会员出错");
}
$setsqlarr['companyname'] = $companyname;
$nature = locoyspider_company_nature(trim($_POST['nature']));
$setsqlarr['nature'] = $nature['id'];
$setsqlarr['nature_cn'] = $nature['cn'];
$trade = locoyspider_company_trade(trim($_POST['trade']));
$setsqlarr['trade'] = $trade['id'];
$setsqlarr['trade_cn'] = $trade['cn'];
$district = locoyspider_company_district(trim($_POST['district']));
$setsqlarr['district'] = $district['district'];
$setsqlarr['sdistrict'] = $district['sdistrict'];
$setsqlarr['district_cn'] = $district['district_cn'];
$scale = locoyspider_company_scale(trim($_POST['scale']));
$setsqlarr['scale'] = $scale['id'];
$setsqlarr['scale_cn'] = $scale['cn'];
$registered = locoyspider_company_registered(trim($_POST['registered']));
$setsqlarr['registered'] = $registered['registered'];
//注册资金
$setsqlarr['currency'] = $registered['currency'];
//注册资金单位(人民币 or 美元)
$setsqlarr['address'] = trim($_POST['address']);
$setsqlarr['contact'] = trim($_POST['contact']);
$setsqlarr['telephone'] = trim($_POST['telephone']);
$setsqlarr['email'] = trim($_POST['email']);
$setsqlarr['website'] = trim($_POST['website']);
$setsqlarr['contents'] = html2text($_POST['contents']);
$setsqlarr['audit'] = intval($locoyspider['company_audit']);
$setsqlarr['addtime'] = time();
$setsqlarr['refreshtime'] = time();
$setsqlarr['robot'] = 1;
//3.4新增字段,3.5也有
$setsqlarr['contact_show'] = 1;
$setsqlarr['telephone_show'] = 1;
$setsqlarr['email_show'] = 1;
$setsqlarr['address_show'] = 1;
if (!$db->inserttable(table('company_profile'), $setsqlarr)) {
exit("添加企业出错");
}
return true;
}
开发者ID:source-hunter,项目名称:74cms,代码行数:46,代码来源:admin_locoyspider_fun.php
示例16: stripslashes
<?php
$autolitpic = (empty($autolitpic) ? '' : $autolitpic);
${$vs[0]} = stripslashes(${$vs[0]});
//获得文章body里的外部资源
if($cfg_isUrlOpen && $remote==1){ ${$vs[0]} = GetCurContent(${$vs[0]}); }
//去除内容中的站外链接
if($dellink==1)
{
${$vs[0]} = str_replace($cfg_basehost,'#basehost#',${$vs[0]});
${$vs[0]} = preg_replace("/(<a[ \t\r\n]{1,}href=[\"']{0,}http:\/\/[^\/]([^>]*)>)|(<\/a>)/isU","",${$vs[0]});
${$vs[0]} = str_replace('#basehost#',$cfg_basehost,${$vs[0]});
}
//自动摘要
if($description=="" && $cfg_auot_description>0)
{
$description = cn_substr(html2text(${$vs[0]}),$cfg_auot_description);
$description = trim(preg_replace("/#p#|#e#/","",$description));
$description = addslashes($description);
$autodes = true;
}
//自动获取缩略图
if($autolitpic==1 && $litpic==''){
$litpic = GetDDImgFromBody(${$vs[0]});
$autopic = true;
}
${$vs[0]} = addslashes(${$vs[0]});
${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$arcID);
?>
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:28,代码来源:inc_arc_makeauto.php
示例17: atm_byte
function atm_byte($value, $datatype)
{
return ccstrlen($datatype == 'htmltext' ? html2text($value) : $value);
}
开发者ID:polarlight1989,项目名称:08cms,代码行数:4,代码来源:fields.cls.php
示例18: html_to_text
/**
* Given HTML text, make it into plain text using external function
*
* @uses $CFG
* @param string $html The text to be converted.
* @return string
*/
function html_to_text($html)
{
global $CFG;
require_once $CFG->libdir . '/html2text.php';
return html2text($html);
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:13,代码来源:elgglib.php
示例19: GetOneArchive
function GetOneArchive($aid)
{
global $dsql;
include_once DEDEINC . "/channelunit.func.php";
$aid = trim(ereg_replace('[^0-9]', '', $aid));
$reArr = array();
$chRow = $dsql->GetOne("Select arc.*,ch.maintable,ch.addtable,ch.issystem From `#@__arctiny` arc left join `#@__channeltype` ch on ch.id=arc.channel where arc.id='{$aid}' ");
if (!is_array($chRow)) {
return $
|
请发表评论