当前位置: 首页>>代码示例>>PHP>>正文


PHP convert_html_to_text函数代码示例

本文整理汇总了PHP中convert_html_to_text函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_html_to_text函数的具体用法?PHP convert_html_to_text怎么用?PHP convert_html_to_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了convert_html_to_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: EnviaCorreoAlta

function EnviaCorreoAlta($strMail, $originado, $destinatario, $num, $fecha, $departamento, $tipo)
{
    require_once '../general/phpmailer/PHPMailerAutoload.php';
    $to = $strMail;
    $from = 'sgcalidad@qualidad.com';
    $mail = new PHPMailer();
    //Correo desde donde se envía (from)
    $mail->setFrom($from, '');
    //Correo de envío (to)
    $mail->addAddress($to, '');
    $mail->CharSet = "UTF-8";
    $mail->Subject = "Sistema de Qualidad";
    $html = '<!DOCTYPE html>
            <html>
                <head>
                    <title>Q-Conta</title>
                    <meta charset="UTF-8">
                    <meta name="viewport" content="width=device-width">
                </head>
                <body>
                    <div><IMG SRC="https://www.qualidad.es/qualidad/images/logo-' . $_SESSION['base'] . '.JPG" width="140" height="70" BORDER="0"></div>
                    <div><h1><font color="blue">Sistema de Gestión de Calidad</font></h1></div>
                    <hr/>    
                    <div><font color="red">MENSAJE AUTOMÁTICO ENVIADO POR EL SISTEMA</font></div>
                    <div>Originado por: <strong>' . $originado . '</strong></div>
                    <div>Destinatario: <strong>' . $destinatario . '</strong></div>
                    <div>En el Sistema de Gestión de la Calidad de ' . $_SESSION['strSesion'] . ' se han llevado a cabo acciones que requieren su intervención.</div>
                    <div>Si por error las acciones detalladas al pie no le afectasen, deberá reenviar este mensaje a la persona afectada o comunicárselo al Departamento de Calidad.</div><br/>
                    <div><font color="red">DESCRIPCIÓN DE LAS ACCIONES</font></div><br/>
                    <div><strong>No Conformidad</strong> número <font color="blue">' . $num . '</font> con fecha <font color="blue">' . $fecha . '</font> que afecta al Departamento de <font color="blue">' . $departamento . '.</font></div><br/>
                    <hr/>    
                    <div>El Departamento de Calidad agradece su participación en el sistema de gestión y su rápida actuación en las acciones mencionadas, orientadas al cumplimiento de los requisitos de la norma UNE-EN ISO 9001:2008.</div><br/>
                    <div>AVISO: esta dirección de correo está destinada al envío de información y no está habilitada para la recepción de mensajes.</div><br/>
                </body>
            </html>';
    //veo si el correo es HTML o texto plano
    if ($tipo === '1') {
        //HTML
        $mail->msgHTML($html);
    } else {
        //texto plano
        $mail->ContentType = 'text/plain';
        $mail->IsHTML(false);
        $html = convert_html_to_text($html);
        $mail->Body = $html;
    }
    if (!$mail->send()) {
        logger('traza', basename($_SERVER['PHP_SELF']) . '-', "Usuario: " . $_SESSION['strUsuario'] . ', Empresa: ' . $_SESSION['srtBD'] . ', SesionID: ' . session_id() . " Correo NO Enviado.");
        return false;
    } else {
        logger('traza', basename($_SERVER['PHP_SELF']) . '-', "Usuario: " . $_SESSION['strUsuario'] . ', Empresa: ' . $_SESSION['srtBD'] . ', SesionID: ' . session_id() . " Correo Enviado CORRECTAMENTE.");
        return true;
    }
}
开发者ID:QualidadInformatica,项目名称:qualidad1,代码行数:54,代码来源:ncssol.php

示例2: encode

 /**
  * Encodes the email into MIME format
  *
  * Returns the MIME Multipart string
  * If the mail is plain text without attachment, the plain text is returned without any change
  *
  * @return string
  */
 public function encode()
 {
     if ($this->email->attachments || strpos($this->email->content, '<body')) {
         /** @var $mail Mail_mime */
         $mail = Builder::create(Mail_mime::class);
         $body = $this->parseImages($mail, $this->email->content);
         $error_reporting = error_reporting();
         error_reporting(E_ALL & ~E_WARNING);
         $mail->setTXTBody(convert_html_to_text($this->email->content));
         error_reporting($error_reporting);
         $mail->setHTMLBody($body);
         $this->addAttachments($mail);
         $mime_params = ['text_encoding' => '8bit', 'text_charset' => 'UTF-8', 'html_charset' => 'UTF-8', 'head_charset' => 'UTF-8'];
         $body = $mail->get($mime_params);
         $this->email->headers = $mail->headers($this->email->getHeadersAsStrings());
         return $body;
     }
     return $this->email->content;
 }
开发者ID:TuxBoy,项目名称:Demo-saf,代码行数:27,代码来源:Encoder.php

示例3: escapeText

 function escapeText($text)
 {
     $text = convert_html_to_text($text);
     if ($this->getConfig()->get('rocketchat-text-escape') == true) {
         $text = str_replace('<br />', '\\n', $text);
         $text = str_replace('<br/>', '\\n', $text);
         $text = str_replace('&', '&amp;', $text);
         $text = str_replace('<', '&lt;', $text);
         $text = str_replace('>', '&gt;', $text);
     }
     if ($this->getConfig()->get('rocketchat-text-doublenl') == true) {
         $text = preg_replace("/[\r\n]+/", "\n", $text);
         $text = preg_replace("/[\n\n]+/", "\n", $text);
     }
     $text = nl2br($text);
     $text = preg_replace('/[\\n]+/', '', $text);
     if (strlen($text) >= $this->getConfig()->get('rocketchat-text-length')) {
         $text = substr($text, 0, $this->getConfig()->get('rocketchat-text-length')) . '...';
     }
     return $text;
 }
开发者ID:tuudik,项目名称:osticket-rocketchat,代码行数:21,代码来源:rocketchat.php

示例4: html2text

function html2text($html)
{
    return convert_html_to_text($html);
}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:4,代码来源:init.lib.php

示例5: file_get_contents

require_once "../wechat/html2text.php";
echo '<h1>获取每日弥撒、日课</h1>';
echo file_get_contents(ROOT_WEB_URL . 'getstuff/checkstuff.php');
$dtstr = gmdate("Y-m-d", time() + 3600 * 8);
$dtnow = intval((time() + 3600 * 8) / (3600 * 24)) * 3600 * 24;
$url = ROOT_WEB_URL . "getstuff/getstuff.php?date=" . $dtstr;
$json = json_decode(file_get_contents($url), true);
if (isset($json['lod'])) {
    //6点发送晨祷信息
    add2weibolist('#晨祷# ' . mb_substr(convert_html_to_text($json['lod']), 0, 40, "UTF-8") . '…… ' . ROOT_WEB_URL . 'getstuff/stuff/' . $dtstr . '_lod.html', $dtnow + 3600 * 6);
}
if (isset($json['mass'])) {
    //7点发送弥撒信息
    add2weibolist('#弥撒# ' . mb_substr(convert_html_to_text($json['mass']), 0, 40, "UTF-8") . '…… ' . ROOT_WEB_URL . 'getstuff/stuff/' . $dtstr . '_mass.html', $dtnow + 3600 * 7);
}
if (isset($json['thought'])) {
    //8点发送反省(读经)信息
    add2weibolist('#读经及反省# ' . mb_substr(convert_html_to_text($json['thought']), 0, 60, "UTF-8") . '…… ' . ROOT_WEB_URL . 'getstuff/stuff/' . $dtstr . '_thought.html', $dtnow + 3600 * 8);
}
if (isset($json['ves'])) {
    //18点发送晚祷信息
    add2weibolist('#晚祷# ' . mb_substr(convert_html_to_text($json['ves']), 0, 40, "UTF-8") . '…… ' . ROOT_WEB_URL . 'getstuff/stuff/' . $dtstr . '_ves.html', $dtnow + 3600 * 18);
}
if (isset($json['comp'])) {
    //18点发送晚祷信息
    add2weibolist('#夜祷# ' . mb_substr(convert_html_to_text($json['comp']), 0, 40, "UTF-8") . '…… ' . ROOT_WEB_URL . 'getstuff/stuff/' . $dtstr . '_comp.html', $dtnow + 3600 * 21);
}
if (isset($json['saint'])) {
    //12点发送圣人传记
    add2weibolist('#圣人传记# ' . mb_substr(convert_html_to_text($json['saint']), 0, 60, "UTF-8") . '…… ' . ROOT_WEB_URL . 'getstuff/stuff/' . $dtstr . '_saint.html', $dtnow + 3600 * 12);
}
开发者ID:gaoerjun,项目名称:Web,代码行数:31,代码来源:checkforday.php

示例6: mailAttachment

                $mobi->setContentProvider($mobiContent);
                $filename = $uniqid . "_" . $story["title"] . " - " . $story["author"] . ".mobi";
                $mobi->save("./tmp/" . $filename);
                if (!empty($email)) {
                    mailAttachment($filename, "./tmp/", $email, $uniqid);
                }
            } else {
                if ($format == "txt") {
                    include_once "include/html2text.php";
                    $output = $story["title"] . "\r\n\r\nby " . $story["author"] . "\r\n\r\n\r\n";
                    for ($i = 0; $i < $numChapter; $i++) {
                        $title = isset($story["chapters"]["title"][$i]) ? $story["chapters"]["title"][$i] : "";
                        $content = isset($story["chapters"]["content"][$i]) ? $story["chapters"]["content"][$i] : "";
                        if (!empty($content) && !empty($title)) {
                            $title = formatTitle($title, $i);
                            $content = convert_html_to_text($content);
                            $output .= $title . "\r\n\r\n" . $content . "\r\n\r\n";
                        }
                    }
                    $filename = $uniqid . "_" . $story["title"] . " - " . $story["author"] . ".txt";
                    file_put_contents("./tmp/" . $filename, $output);
                    if (!empty($email)) {
                        mailAttachment($filename, "./tmp/", $email, $uniqid);
                    }
                }
            }
        }
    }
    exit(0);
} else {
    exit(0);
开发者ID:NakedFury,项目名称:FicSave,代码行数:31,代码来源:exec.php

示例7: getSubArticle

 private function getSubArticle($mode, $content, $isLarge, $offset)
 {
     $titlemap = array('mass' => '弥撒及读经', 'med' => '日祷经文', 'lod' => '晨祷经文', 'ves' => '晚祷经文', 'comp' => '夜祷经文', 'let' => '诵读', 'thought' => '反省', 'ordo' => '礼仪', 'saint' => '圣人传记');
     $title = "";
     $url = ROOT_WEB_URL . "getstuff/stuff/" . gmdate("Y-m-d", time() + 3600 * 8 + $offset * 24 * 3600) . "_" . $mode . ".html";
     if ($content == "") {
         $content = convert_html_to_text(file_get_contents($url));
     }
     $picurl = ROOT_WEB_URL . "wechat/pics/" . $mode . "1.jpg";
     if (isset($titlemap[$mode])) {
         $title = $titlemap[$mode];
     }
     $textTpl = '<item><Title><![CDATA[%s]]></Title><Url><![CDATA[%s]]></Url><Description><![CDATA[%s]]></Description><PicUrl><![CDATA[%s]]></PicUrl></item>';
     $resultStr = "";
     if ($isLarge > 0) {
         $picurl = ROOT_WEB_URL . "wechat/pics/" . $mode . "_l1.jpg";
         $index = strpos($content, "\n", 140);
         $desc = "";
         if ($index > 0) {
             $title = $title . "\n" . substr($content, 0, $index);
             $desc = substr($content, 0, $index);
         } else {
             $desc = mb_substr($content, 0, 20, "UTF-8");
         }
         $resultStr = sprintf($textTpl, $title, $url, $desc, $picurl);
     } else {
         $index = strpos($content, "\n", 20);
         if ($index > -1 and $index < 100) {
             $title = $title . "\n" . substr($content, 0, $index);
         } else {
             $title = $title . "\n" . mb_substr($content, 0, 30, "UTF-8");
         }
         $resultStr = sprintf($textTpl, $title, $url, mb_substr($content, 0, 30, "UTF-8"), $picurl);
     }
     return $resultStr;
 }
开发者ID:gaoerjun,项目名称:Web,代码行数:36,代码来源:test.php

示例8: html2text

 function html2text($html, $width = 74, $tidy = true)
 {
     # Tidy html: decode, balance, sanitize tags
     if ($tidy) {
         $html = Format::html(Format::htmldecode($html), array('balance' => 1));
     }
     # See if advanced html2text is available (requires xml extension)
     if (function_exists('convert_html_to_text') && extension_loaded('dom')) {
         return convert_html_to_text($html, $width);
     }
     # Try simple html2text  - insert line breaks after new line tags.
     $html = preg_replace(array(':<br ?/?\\>:i', ':(</div>)\\s*:i', ':(</p>)\\s*:i'), array("\n", "\$1\n", "\$1\n\n"), $html);
     # Strip tags, decode html chars and wrap resulting text.
     return Format::wrap(Format::htmldecode(Format::striptags($html, false)), $width);
 }
开发者ID:gizur,项目名称:osticket,代码行数:15,代码来源:class.format.php

示例9: get_text

 /** 
  * @deprecated use html2text.php convert_html_to_text function instead
  */
 public function get_text()
 {
     return convert_html_to_text($this->html);
 }
开发者ID:mymizan,项目名称:phreeze,代码行数:7,代码来源:class.html2text.php

示例10: DownConvertHTML

 static function DownConvertHTML($_content)
 {
     @set_error_handler("ignoreError");
     try {
         require_once LIVEZILLA_PATH . "_lib/trdp/html2text.php";
         $_content = convert_html_to_text($_content);
     } catch (Exception $e) {
         $_content = preg_replace("/<style\\b[^>]*>(.*?)<\\/style>/s", "", $_content);
         $_content = trim(html_entity_decode(strip_tags($_content), ENT_COMPAT, "UTF-8"));
         $_content = preg_replace('/[\\s\\s\\s\\s\\s\\s]+/', " ", $_content);
     }
     @set_error_handler("handleError");
     return $_content;
 }
开发者ID:sgh1986915,项目名称:laravel-eyerideonline,代码行数:14,代码来源:objects.mail.inc.php

示例11: HtmlToText

 /**
  * Transforms HTML into formatted plain text.
  * 
  * @param string HTML
  * @return string plain text
  */
 static function HtmlToText($html)
 {
     return convert_html_to_text($html);
 }
开发者ID:mymizan,项目名称:phreeze,代码行数:10,代码来源:SimpleTemplate.php

示例12: cleanedHtml

 /**
  * Clean a string embedding html, producing AltText for html mails
  *
  * @return current message in plaintext format
  */
 protected function cleanedHtml()
 {
     $html = $this->message;
     $txt = convert_html_to_text($html);
     return $txt;
 }
开发者ID:Killerfun,项目名称:galette,代码行数:11,代码来源:GaletteMail.php

示例13: gotoend

function gotoend()
{
    global $mode;
    global $isjson;
    global $date;
    global $stuff_mass;
    global $stuff_med;
    global $stuff_comp;
    global $stuff_let;
    global $stuff_lod;
    global $stuff_thought;
    global $stuff_ordo;
    global $stuff_ves;
    global $stuff_saint;
    global $trimedUtf8;
    $ret["mass"] = $stuff_mass;
    $ret["med"] = $stuff_med;
    $ret["comp"] = $stuff_comp;
    $ret["let"] = $stuff_let;
    $ret["lod"] = $stuff_lod;
    $ret["thought"] = '<audio id="audio" src="' . 'http://media.cathassist.org/thought/mp3/' . $date->format('Y-m-d') . '.mp3" controls>反省(' . $date->format('Y-m-d') . ')</audio>' . $stuff_thought;
    $ret["ordo"] = $stuff_ordo;
    $ret["ves"] = $stuff_ves;
    $ret["saint"] = $stuff_saint;
    if ($isjson > 0) {
        $ret = json_encode($ret);
        if ($isjson == 2) {
            echo $_GET['callback'] . '(' . $ret . ')';
            die;
        }
    } else {
        $ret = '<mass>' . htmlspecialchars($stuff_mass, ENT_QUOTES) . '</mass><med>' . htmlspecialchars($stuff_med, ENT_QUOTES) . '</med><comp>' . htmlspecialchars($stuff_comp, ENT_QUOTES) . '</comp><let>' . htmlspecialchars($stuff_let, ENT_QUOTES) . '<let><lod>' . htmlspecialchars($stuff_lod, ENT_QUOTES) . '</lod><thought>' . htmlspecialchars($stuff_thought, ENT_QUOTES) . '</thought><ordo>' . htmlspecialchars($stuff_ordo, ENT_QUOTES) . '</ordo><ves>' . htmlspecialchars($stuff_ves, ENT_QUOTES) . '</ves><saint>' . htmlspecialchars($stuff_saint, ENT_QUOTES) . '</saint>';
    }
    $ret = str_replace($trimedUtf8, "", $ret);
    if ($mode != "") {
        $json = json_decode($ret, true);
        $content = convert_html_to_text($json[$mode]);
        $title = str_replace(PHP_EOL, ' ', mb_substr($content, 0, 20, "UTF-8"));
        echo '<head><meta name="viewport" content="user-scalable=no, width=device-width"/><meta http-equiv=Content-Type content="text/html;charset=utf-8"><title>' . $title . '</title>
		<link href="/css/stuff.css" type="text/css" rel="stylesheet"></head><html><body>';
        if ($mode == "lod") {
            $lod_all = $json[$mode];
            $index_h2 = strpos($lod_all, "</h2>", 0);
            if ($index_h2 > 4 and $index_h2 < 128) {
                $lod_first = "<p><strong>序经</strong><br><strong>领</strong>:上主,求祢开启我的口。<br><strong>答</strong>:我的口要赞美祢。</p><p><strong>对经</strong>:基督是牧者们的首领,请大家前来朝拜祂,阿肋路亚。</p><p>请大家前来,向上主欢呼,<br>向拯救我们的磐石歌舞。<br>一齐到祂面前感恩赞颂,<br>向祂歌唱圣诗,欢呼吟咏。<br><strong>对经</strong>:基督是牧者们的首领,请大家前来朝拜祂,阿肋路亚。</p><p>因为上主是崇高的天主,<br>是超越诸神的伟大君王;<br>大地深渊都在祂的手中,<br>高山峻岭都是祂的化工,<br>海洋属于祂,因为是祂所创造,<br>陆地属于祂,因为是祂所形成。<br><strong>对经</strong>:基督是牧者们的首领,请大家前来朝拜祂,阿肋路亚。</p><p>请大家前来叩首致敬,<br>向造我们的天主跪拜,<br>因为祂是我们的天主,<br>我们是祂牧养的子民,<br>是祂亲手领导的羊羣。<br><strong>对经</strong>:基督是牧者们的首领,请大家前来朝拜祂,阿肋路亚。</p><p>你们今天要听从祂的声音,<br>不要像在默黎巴那样心硬,<br>不要像在旷野中玛撒那天,<br>你们的祖先看到我的工作,<br>在那里仍然试探我,考验我。<br><strong>对经</strong>:基督是牧者们的首领,请大家前来朝拜祂,阿肋路亚。</p><p>我四十年之久厌恶那一世代,<br>我曾说:这个民族冥顽不灵,<br>他们不肯承认我的道路;<br>因此,我在盛怒之下起誓说:<br>他们绝不得进入我的安居之所。<br><strong>对经</strong>:基督是牧者们的首领,请大家前来朝拜祂,阿肋路亚。</p><p>愿光荣归于父、及子、及圣神。<br>起初如何,今日亦然,直到永远。阿们。<br><strong>对经</strong>:基督是牧者们的首领,请大家前来朝拜祂,阿肋路亚。</p>";
                $index_h2 = $index_h2 + 5;
                echo substr($lod_all, 0, $index_h2) . $lod_first . substr($lod_all, $index_h2);
            } else {
                echo $lod_all;
            }
        } else {
            if ($mode == "thought") {
                echo $json[$mode];
            } else {
                echo $json[$mode];
            }
        }
        $imgurl = ROOT_WEB_URL . "wechat/pics/" . $mode . "1.jpg";
        $link = ROOT_WEB_URL . 'getstuff/stuff/' . $_GET["date"] . '_' . $mode . '.html';
        echo '</body><script type="text/javascript" language="javascript" src="/include/googleanalysis.js"></script>' . getWechatShareScript($link, $title, $imgurl) . '</html>';
    } else {
        echo $ret;
    }
    die;
}
开发者ID:gaoerjun,项目名称:Web,代码行数:65,代码来源:getstuff3.php

示例14: prep_message_body

 function prep_message_body($body)
 {
     if (!$this->html) {
         $body = mb_convert_encoding(trim($body), "HTML-ENTITIES", "UTF-8");
         $body = mb_convert_encoding($body, "UTF-8", "HTML-ENTITIES");
         $body = $this->format_message_text($body);
         $this->headers['Content-Type'] = 'text/plain; charset=UTF-8; format=flowed';
         $this->headers['Content-Transfer-Encoding'] = 'quoted-printable';
     } else {
         $txt = convert_html_to_text($body);
         $this->text_body = sprintf("--%s\r\nContent-Type: text/plain; charset=UTF-8; format=flowed\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n%s", $this->boundary, $this->format_message_text($txt));
         $body = sprintf("--%s\r\nContent-Type: text/html; charset=UTF-8; format=flowed\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n%s", $this->boundary, $this->format_message_text($body));
         $this->headers['Content-Type'] = 'multipart/alternative; boundary=' . $this->boundary;
     }
     return $body;
 }
开发者ID:GordonDiggs,项目名称:hm3,代码行数:16,代码来源:hm-mime-message.php

示例15: setCampaignFiles

 function setCampaignFiles($content)
 {
     require_once $this->modx->getOption('cmx.core_path', null, $this->modx->getOption('core_path') . 'components/cmx/') . 'library/html2text.php';
     $rand = rand(111111111, 999999999);
     $filename_html = $rand . '.html';
     $filename_txt = $rand . '.txt';
     if (!file_exists($this->assets_cache_path . $filename_html)) {
         if (!$this->setAssetsCached($filename_html, $content)) {
             // problem saving html copy
             return false;
         }
     } else {
         return false;
     }
     if (!file_exists($this->assets_cache_path . $filename_txt)) {
         if (!$this->setAssetsCached($filename_txt, convert_html_to_text($content))) {
             // problem saving txt copy
             return false;
         }
     } else {
         return false;
     }
     return $rand;
 }
开发者ID:node-migrator-bot,项目名称:cmx,代码行数:24,代码来源:cmhandler.class.php


注:本文中的convert_html_to_text函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。