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


PHP Html2Text函数代码示例

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


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

示例1: lib_feedback

function lib_feedback(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|12,titlelen|24,infolen|100";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    $totalrow = $row;
    $revalue = '';
    if (empty($innertext)) {
        $innertext = GetSysTemplets('tag_feedback.htm');
    }
    $wsql = " where ischeck=1 ";
    $equery = "SELECT * FROM `#@__feedback` {$wsql} ORDER BY id DESC LIMIT 0 , {$totalrow}";
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innertext);
    $dsql->Execute('fb', $equery);
    while ($arr = $dsql->GetArray('fb')) {
        $arr['title'] = cn_substr($arr['arctitle'], $titlelen);
        $arr['msg'] = jsTrim(Html2Text($arr['msg']), $infolen);
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($arr[$ctag->GetName()])) {
                $ctp->Assign($tagid, $arr[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
开发者ID:iabing,项目名称:mzzyc,代码行数:30,代码来源:feedback.lib.php

示例2: ClearHtml

function ClearHtml($str)
{
    $str = Html2Text($str);
    $str = str_replace('<', '&lt;', $str);
    $str = str_replace('>', '&gt;', $str);
    return $str;
}
开发者ID:BGCX261,项目名称:zlskytakeorder-svn-to-git,代码行数:7,代码来源:inc_functions.php

示例3: savegbform

function savegbform()
{
    global $db;
    $title = Html2Text($_POST["title"]);
    $content = HtmlReplace($_POST["content"]);
    $fileurl = HtmlReplace($_POST["fileurl"]);
    $replyid = intval($_POST["replyid"]);
    if (empty($title) || empty($content)) {
        header("location:./");
        exit;
    } else {
        $array = array('title' => $title, 'content' => $content, 'fileurl' => $fileurl, 'replyid' => $replyid, 'addtime' => time(), 'ip' => ip());
        $db->insert("ve123_guestbook", $array);
        header("location:./");
    }
}
开发者ID:tanny2015,项目名称:DataStructure,代码行数:16,代码来源:index.php

示例4: savegbform

function savegbform()
{
    global $db, $http_referer;
    $title = Html2Text($_POST["title"]);
    $content = HtmlReplace($_POST["content"]);
    $fileurl = HtmlReplace($_POST["fileurl"]);
    $replyid = intval($_POST["replyid"]);
    if (empty($title) || empty($content)) {
        header("location:" . $http_referer . "");
        exit;
    } else {
        $array = array('title' => $title, 'content' => $content, 'fileurl' => $fileurl, 'replyid' => $replyid, 'addtime' => time(), 'ip' => ip());
        $db->insert("kuaso_guestbook", $array);
        $db->query("update kuaso_guestbook set reply_time='" . time() . "' where gid='" . $replyid . "'");
        header("location:" . $http_referer . "");
    }
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:17,代码来源:index.php

示例5: url

 function url($url)
 {
     $this->url = $url;
     $data = $this->getFileContents($url);
     if ($data["state"] == "ok") {
         $file = $data["file"];
     } else {
         $file = $this->getfile($url);
     }
     $this->charset = $data["charset"];
     $file = $this->Convert_File($file, $data["charset"]);
     $this->htmlcode = $file;
     $data = $this->clean_file($file, $url, "html");
     $this->title = $data["title"];
     $this->fulltxt = Html2Text($data["fulltext"]);
     $this->pagesize = number_format(strlen($file) / 1024, 0, ".", "");
     $this->keywords = $data["keywords"];
     $this->description = $data["description"];
 }
开发者ID:tanny2015,项目名称:DataStructure,代码行数:19,代码来源:spider_class.php

示例6: SplitWord

 $dsql->SetQuery($fquery);
 $dsql->Execute();
 $sp = new SplitWord();
 while ($row = $dsql->GetObject()) {
     if ($row->keywords != '') {
         continue;
     }
     $tjnum++;
     $id = $row->id;
     $keywords = "";
     if ($cfg_soft_lang == 'utf-8') {
         $row->title = utf82gb($row->title);
         $row->body = utf82gb($row->body);
     }
     $titleindexs = explode(' ', trim($sp->GetIndexText($row->title)));
     $allindexs = explode(' ', trim($sp->GetIndexText(Html2Text($row->body), 500)));
     if (is_array($allindexs) && is_array($titleindexs)) {
         foreach ($titleindexs as $k) {
             if (strlen($keywords) >= 30) {
                 break;
             } else {
                 $keywords .= $k . ",";
             }
         }
         foreach ($allindexs as $k) {
             if (strlen($keywords) >= 30) {
                 break;
             } else {
                 if (!in_array($k, $titleindexs)) {
                     $keywords .= $k . ",";
                 }
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:article_keywords_make.php

示例7: fetchtext

 function fetchtext($URI)
 {
     if ($this->fetch($URI)) {
         if (is_array($this->results)) {
             for ($x = 0; $x < count($this->results); $x++) {
                 $this->results[$x] = $this->_striptext($this->results[$x]);
             }
         } else {
             $this->bianma = $this->bianma($this->results);
         }
         //获取得到htmlcode的编码
         $this->results = $this->Convert_File($this->results, $this->bianma);
         //转换所有编码为gb2312
         //$this->results=$this->clean_html($this->results, $URI,"html");    //清除代码中非法字符和格式,赋值给输出指针
         //$this->title = $this->get_title($this->results);//过滤htmlcode全文为标题
         //$this->pagesize=number_format(strlen($this->results)/1024, 0, ".", "");
         //$this->fulltxt = $this->_striptext($this->results);//过滤htmlcode全文为文本
         $lry = $this->clean_file($this->results, $URI, "html");
         $this->title = $lry["title"];
         //从数组中得到标题,赋值给title
         $this->pagesize = number_format(strlen($this->results) / 1024, 0, ".", "");
         //$this->fulltxt=$this->_striptext($lry["fulltext"]);     //转换html格式为文本 赋值给fulltxt
         $this->fulltxt = Html2Text($lry["fulltext"]);
         $this->description = $lry["description"];
         //从数组中得到标题,赋值给description
         $this->keywords = $lry["keywords"];
         //从数组中得到标题,赋值给keywords
         return true;
     } else {
         return false;
     }
 }
开发者ID:tanny2015,项目名称:DataStructure,代码行数:32,代码来源:snoopy.class.php

示例8: toXml

    function toXml()
    {
        global $dsql, $cfg_webname, $cfg_basehost, $cfg_soft_lang;
        $addonQuery = $limitQuery = "";
        if (!empty($this->Typeid)) {
            $addonQuery .= "AND arc.typeid=" . intval($this->Typeid);
            $typeinfos = $this->getType($this->Typeid);
        }
        if ($this->SitemapType == 2) {
            $setupmaxaid = baidu_get_setting('setupmaxaid');
            $addonQuery .= "AND arc.id>" . intval($setupmaxaid);
        }
        $this->Start = intval($this->Start);
        //var_dump($typeinfos);exit();
        if (!empty($this->Row)) {
            $limitQuery = "LIMIT  {$this->Start}," . intval($this->Row);
        }
        $query = "SELECT arc.*,arc.senddate AS pubdate,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,\n\t\t\ttp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,at.body\n\t\t\tFROM `{$this->MainTable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n            LEFT JOIN `#@__addonarticle` at ON arc.id=at.aid\n\t\t\tWHERE arc.arcrank=0 AND arc.arcrank > -1 AND arc.channel=1 {$addonQuery} ORDER BY arc.senddate DESC {$limitQuery}";
        //var_dump($query);
        $dsql->SetQuery($query);
        $dsql->Execute('dd');
        $xmlstr = '<?xml version="1.0" encoding="UTF-8"?>
<urlset>';
        $setupmaxaid = 0;
        while ($row = $dsql->GetArray('dd')) {
            $row['id'] = isset($row['aid']) ? $row['aid'] : $row['id'];
            $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], 1, 0, $row['namerule'], $row['typedir'], 0, '', $row['moresite'], $row['siteurl'], $row['sitepath']);
            $row['showdate'] = Mydate('Y-m-d', $row['pubdate']);
            $row['priority'] = 0;
            $row['body'] = isset($row['body']) ? Html2Text($row['body']) : '';
            $row['body'] = empty($row['body']) ? $row['description'] : $row['body'];
            //var_dump($row);exit;
            if (preg_match("#c#", $row['flag'])) {
                $row['priority'] = '1.0';
            }
            if (!isset($typeinfos)) {
                $typeinfos = $this->getType($row['typeid']);
            }
            //var_dump($typeinfo);exit();
            //var_dump($row);
            $row['source'] = trim(Html2Text($row['source']));
            $row['title'] = baidu_strip_invalid_xml($row['title']);
            $row['body'] = baidu_strip_invalid_xml($row['body']);
            $addstr = $copyrightstr = $yearstr = "";
            $copyrightstr = !empty($row['source']) ? "\r\n\t\t\t\t\t<copyrightHolder><name><![CDATA[{$row['source']}]]></name></copyrightHolder>" : '';
            $addstr .= empty($row['litpic']) ? "" : "\r\n\t\t\t\t\t<image><![CDATA[{$row['litpic']}]]></image>";
            $yearstr = Mydate('Y', $row['pubdate']);
            $rowxmlstr = <<<EOT
\t
\t<url>
\t\t\t<loc><![CDATA[{$cfg_basehost}{$row['filename']}]]></loc>
\t\t\t<lastmod>{$row['showdate']}</lastmod>
\t\t\t<changefreq>always</changefreq>
\t\t\t<priority>{$row['priority']}</priority>
\t\t\t<data>
\t\t\t\t<Webpage>
\t\t\t\t\t<name><![CDATA[{$row['title']}]]></name>
\t\t\t\t\t<url><![CDATA[{$cfg_basehost}{$row['filename']}]]></url>
\t\t\t\t\t<provider>
\t\t\t\t\t\t<name><![CDATA[{$cfg_webname}]]></name>
\t\t\t\t\t\t<url><![CDATA[{$cfg_basehost}]]></url>
\t\t\t\t\t</provider>
\t\t\t\t\t<description><![CDATA[{$row['description']}]]></description>
                    <text><![CDATA[{$row['body']}]]></text>
                    <keywords><![CDATA[{$row['keywords']}]]></keywords>
\t\t\t\t\t<breadcrumb><![CDATA[{$typeinfos['position']}]]></breadcrumb>
\t\t\t\t\t{$addstr}
                    <isPartOf>
\t\t\t\t\t\t<name><![CDATA[{$typeinfos['typename']}]]></name>
\t\t\t\t\t\t<url><![CDATA[{$cfg_basehost}{$typeinfos['typelink']}]]></url>
\t\t\t\t\t</isPartOf>
                    {$copyrightstr}
\t\t\t\t\t<copyrightYear>{$yearstr}</copyrightYear>
\t\t\t\t</Webpage>
\t\t\t</data>
\t\t</url>
EOT;
            if ($cfg_soft_lang == 'gb2312') {
                $rowxmlstr = gb2utf8($rowxmlstr);
            }
            //var_dump($rowxmlstr);exit;
            $xmlstr .= $rowxmlstr;
        }
        //exit($xmlstr);
        $xmlstr .= "\r\n</urlset>";
        //$xmldata['content'] = $xmlstr;
        return $xmlstr;
    }
开发者ID:CMS-CHINA,项目名称:secondary-development-of-Dedecms,代码行数:88,代码来源:baiduxml.class.php

示例9: lib_duoshuo

function lib_duoshuo(&$ctag, &$refObj)
{
    global $dsql, $cfg_basehost, $cfg_cmspath;
    $plugin = Duoshuo_Dedecms::getInstance();
    if ($plugin->getOption('short_name') == '' || $plugin->getOption('secret') == '') {
        return '在管理后台进行一步配置,就可以开始使用多说了';
    }
    $attlist = 'type|0';
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (empty($refObj->Fields['aid'])) {
        return '';
    }
    $arcid = $refObj->Fields['aid'];
    //设置参数
    $attrs = array();
    $attrs[] = ' data-thread-key="' . $arcid . '"';
    $attrs[] = 'data-author-key="' . $refObj->Fields["mid"] . '"';
    /*
    if(empty($refObj->Fields['arcurl'])){
    	$refObj->Fields['arcurl'] = $refObj->GetTrueUrl(null);
    }
    if(strpos($refObj->Fields['arcurl'],$cfg_basehost) === false){
    	$attrs[] = ' data-url="'.$cfg_basehost.$refObj->Fields['arcurl'].'"';
    }
    
    $attrs[] = ' data-url="'.$refObj->Fields['arcurl'].'"';
    */
    $article_url = $refObj->GetTrueUrl(null);
    if (!strpos($article_url, 'http:')) {
        $article_url = $cfg_basehost . $article_url;
    }
    if (!empty($refObj->Fields['litpic']) && !preg_match('/\\/images\\/defaultpic.gif/', $refObj->Fields['litpic'])) {
        $attrs[] = ' data-image="' . $refObj->Fields['litpic'] . '"';
    }
    if (!empty($refObj->Fields['title'])) {
        $attrs[] = 'data-title="' . htmlspecialchars($refObj->Fields['title'], ENT_QUOTES, 'GB2312') . '"';
    }
    //输出评论框
    ob_start();
    require DEDEROOT . '/plus/duoshuo/templates/comments.htm';
    if ($plugin->getOption('seo_enabled') && !empty($arcid)) {
        // 每篇评论最大字数
        $infolen = 200;
        // 每篇文章seo显示的最大行数
        $totalrow = 100;
        $innertext = file_get_contents(DEDEROOT . '/plus/duoshuo/templates/comments_seo.htm');
        ?>
<div id="ds-ssr" class="mt1">
	<dl class="tbox">
		<dt> <strong>评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)</strong> </dt>
		<dd>
			<div class="dede_comment">
				<div class="decmt-box1">
					<ul>
						<li id="commetcontentNew"></li>

<?php 
        $wsql = " WHERE ischeck=1 AND aid = {$arcid}";
        $equery = "SELECT * FROM `#@__feedback` {$wsql} ORDER BY id DESC LIMIT 0 , {$totalrow}";
        $ctp = new DedeTagParse();
        $ctp->SetNameSpace('field', '[', ']');
        $ctp->LoadSource($innertext);
        $dsql->Execute('fb', $equery);
        while ($arr = $dsql->GetArray('fb')) {
            $arr['msg'] = jsTrim(Html2Text($arr['msg']), $infolen);
            $arr['dtime'] = GetDateTimeMK($arr['dtime']);
            $arr['username'] = $str = str_replace('&lt;br/&gt;', ' ', $arr['username']);
            foreach ($ctp->CTags as $tagid => $ctag) {
                if (!empty($arr[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $arr[$ctag->GetName()]);
                }
            }
            echo $ctp->GetResult();
        }
        ?>
 
					</ul>
				</div>
			</div>
		</dd>
	</dl>
</div>

<?php 
    }
    return ob_get_clean();
}
开发者ID:CMS-CHINA,项目名称:duoshuo-plugins-dedecms,代码行数:88,代码来源:duoshuo.lib.php

示例10: Html2Text

<html><head><meta http-equiv=content-type content="text/html;charset=gb2312">
<title><?php 
echo Html2Text($title) . "--" . $config["name"];
?>
</title>
<style>
<!--
body{margin:0px;font-size:12px;font-family:Arial;line-height:180%}
td{font-size:12px;}
img{border:0}
.b{border:1px solid #A1C0DC;margin-bottom:8px;}
.b a{text-decoration:none;}
.b a:hover{text-decoration:underline;}
.b1{padding:4px 0 4px 10px;}
.b2{padding:6px 5px 4px 10px;font-size:14px;line-height:150%}
.b2 img{border:1px solid #D0E3F2;}
-->
</style>

<table width=910 border=0 align="center" cellpadding=0 cellspacing=0>
  <td height=3 bgcolor=005CCD></td>
</table>
<br>
<table width=910 border=0 align="center" cellpadding=0 cellspacing=0>
  <tr>
    <td width=175 rowspan=3><a href="<?php 
echo $config["url"];
?>
"><img src="<?php 
echo $config["url"] . "/images/logo.gif";
?>
开发者ID:tanny2015,项目名称:DataStructure,代码行数:31,代码来源:a.php

示例11: dirname

require_once dirname(__FILE__) . "/config.php";
require_once DEDEINC . "/typelink.class.php";
if (empty($dopost)) {
    $dopost = '';
}
$id = isset($id) ? intval($id) : 0;
//检查权限许可
CheckPurview('t_Edit,t_AccEdit');
//检查栏目操作许可
CheckCatalog($id, '你无权更改本栏目!');
/*-----------------------
function action_save()
----------------------*/
if ($dopost == "save") {
    $description = Html2Text($description, 1);
    $keywords = Html2Text($keywords, 1);
    $uptopsql = $smalltypes = '';
    if (isset($smalltype) && is_array($smalltype)) {
        $smalltypes = join(',', $smalltype);
    }
    if ($topid == 0) {
        $sitepath = $typedir;
        $uptopsql = " ,siteurl='{$siteurl}',sitepath='{$sitepath}',ishidden='{$ishidden}' ";
    }
    if ($ispart != 0) {
        $cross = 0;
    }
    $upquery = "UPDATE `#@__arctype` SET\n     issend='{$issend}',\n     sortrank='{$sortrank}',\n     typename='{$typename}',\n     typedir='{$typedir}',\n     isdefault='{$isdefault}',\n     defaultname='{$defaultname}',\n     issend='{$issend}',\n     ishidden='{$ishidden}',\n     channeltype='{$channeltype}',\n     tempindex='{$tempindex}',\n     templist='{$templist}',\n     temparticle='{$temparticle}',\n     namerule='{$namerule}',\n     namerule2='{$namerule2}',\n     ispart='{$ispart}',\n     corank='{$corank}',\n     description='{$description}',\n     keywords='{$keywords}',\n     seotitle='{$seotitle}',\n     moresite='{$moresite}',\n\t picname='{$picname}',\n     `cross`='{$cross}',\n     `content`='{$content}',\n     `crossid`='{$crossid}',\n     `smalltypes`='{$smalltypes}'\n     {$uptopsql}\n    WHERE id='{$id}' ";
    if (!$dsql->ExecuteNoneQuery($upquery)) {
        ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1");
        exit;
开发者ID:nothingsoga1,项目名称:shfayidiyj,代码行数:31,代码来源:catalog_edit.php

示例12: AnalyseHtmlBody

function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '')
{
    global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_soft_lang;
    $autolitpic = empty($autolitpic) ? '' : $autolitpic;
    $body = stripslashes($body);
    //远程图片本地化
    if ($remote == 1) {
        $body = GetCurContent($body);
    }
    //删除非站内链接
    if ($dellink == 1) {
        $basehost = "http://" . $_SERVER['HTTP_HOST'];
        $body = str_replace($cfg_basehost, '#basehost#', $body);
        $body = str_replace($basehost, '#2basehost2#', $body);
        $body = preg_replace("/(<a[ \t\r\n]{1,}href=[\"']{0,}http:\\/\\/[^\\/]([^>]*)>)|(<\\/a>)/isU", "", $body);
        $body = str_replace('#basehost#', $cfg_basehost, $body);
        $body = str_replace('#2basehost2#', $basehost, $body);
    }
    //自动摘要
    if ($description == '' && $cfg_auot_description > 0) {
        $description = cn_substr(html2text($body), $cfg_auot_description);
        $description = trim(preg_replace('/#p#|#e#/', '', $description));
        $description = addslashes($description);
    }
    //自动获取缩略图
    if ($autolitpic == 1 && $litpic == '') {
        $litpic = GetDDImgFromBody($body);
    }
    //自动获取关键字
    if ($autokey == 1 && $keywords == '') {
        $subject = $title;
        $message = $body;
        if ($cfg_soft_lang == 'utf-8') {
            $subject = utf82gb($title);
            $message = utf82gb($message);
        }
        include_once DEDEINC . '/splitword.class.php';
        $keywords = '';
        $sp = new SplitWord();
        $titleindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText($subject)));
        $allindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText(Html2Text($message), 500)));
        if (is_array($allindexs) && is_array($titleindexs)) {
            foreach ($titleindexs as $k) {
                if (strlen($keywords . $k) >= 60) {
                    break;
                } else {
                    $keywords .= $k . ',';
                }
            }
            foreach ($allindexs as $k) {
                if (strlen($keywords . $k) >= 60) {
                    break;
                } else {
                    if (!in_array($k, $titleindexs)) {
                        $keywords .= $k . ',';
                    }
                }
            }
        }
        $sp->Clear();
        $sp = null;
    }
    $body = GetFieldValueA($body, $dtype, $id);
    $body = addslashes($body);
    return $body;
}
开发者ID:klr2003,项目名称:sourceread,代码行数:66,代码来源:inc_archives_functions.php

示例13: Html2Text

    $description = Html2Text($description, 1);
    $query = "INSERT INTO #@__mail_type (typename,description) VALUES ('{$typename}','{$description}')";
    if (!$dsql->ExecuteNoneQuery($query)) {
        ShowMsg("更新数据库#@__mail_type表时出错,请检查!", "javascript:;");
        exit;
    } else {
        ShowMsg("添加分类成功!", "mail_type.php");
        exit;
    }
} elseif ($dopost == "editsave") {
    if ($typename == "") {
        ShowMsg("分类名不能为空", "-1");
        exit;
    }
    $typename = Html2Text($typename, 1);
    $description = Html2Text($description, 1);
    $query = "UPDATE #@__mail_type SET typename='{$typename}',description='{$description}' WHERE id={$id}";
    if (!$dsql->ExecuteNoneQuery($query)) {
        ShowMsg("更新数据库#@__mail_type表时出错,请检查!", "javascript:;");
        exit;
    } else {
        ShowMsg("更改分类成功!", "mail_type.php");
        exit;
    }
} elseif ($dopost == "delete") {
    $dsql->ExecuteNoneQuery("Delete From `#@__mail_type` where id='{$id}'");
    ShowMsg("删除分类成功!", "mail_type.php");
    exit;
} else {
    $sql = "SELECT * FROM `#@__mail_type` ORDER BY id ";
    $dlist = new DataListCP();
开发者ID:iabing,项目名称:mzzyc,代码行数:31,代码来源:mail_type.php

示例14: GetInnerText

 /**
  *  获得和下一个标记之间的文本内容
  *
  * @access    public
  * @param     string  $pos  位置地址
  * @param     string  $tagname  标签名称
  * @return    string
  */
 function GetInnerText(&$pos, $tagname)
 {
     $startPos = 0;
     $endPos = 0;
     $textLen = 0;
     $str = '';
     $startPos = strpos($this->SourceHtml, '>', $pos);
     if ($tagname == 'title') {
         $endPos = strpos($this->SourceHtml, '<', $startPos);
     } else {
         $endPos1 = strpos($this->SourceHtml, '</a', $startPos);
         $endPos2 = strpos($this->SourceHtml, '</A', $startPos);
         if ($endPos1 === false) {
             $endPos = $endPos2;
         } else {
             if ($endPos2 === false) {
                 $endPos = $endPos1;
             } else {
                 $endPos = $endPos1 < $endPos2 ? $endPos1 : $endPos2;
             }
         }
     }
     if ($endPos > $startPos) {
         $textLen = $endPos - $startPos;
         $str = substr($this->SourceHtml, $startPos + 1, $textLen - 1);
     }
     $pos = $startPos + $textLen + strlen("</" . $tagname) + 1;
     if ($tagname == 'title') {
         return trim($str);
     } else {
         preg_match_all("/<img(.*)src=[\"']{0,1}(.*)[\"']{0,1}[> \r\n\t]{1,}/isU", $str, $imgs);
         if (isset($imgs[2][0])) {
             $txt = trim(Html2Text($str));
             $imgs[2][0] = preg_replace("/[\"']/", '', $imgs[2][0]);
             return "img:" . $this->FillUrl($imgs[2][0]) . ':txt:' . $txt;
         } else {
             $str = strip_tags($str);
             //$str = preg_replace('/<\/(.*)$/i', '', $str);
             //$str = trim(preg_replace('/^(.*)>/i','',$str));
             return $str;
         }
     }
 }
开发者ID:iabing,项目名称:mzzyc,代码行数:51,代码来源:dedehtml2.class.php

示例15: isset

                                            }
                                            if (empty($seo_info['baidu_count']) and preg_match("#网站共有([\\d, ]+)个#", $html, $matches)) {
                                                $seo_info['baidu_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
                                            }
                                            $seo_info['baidu_count'] = empty($seo_info['baidu_count']) ? 0 : $seo_info['baidu_count'];
                                            $url = "http://www.sogou.com/web?query=site:{$site}";
                                            $html = Html2Text(dedeseo_http_send($url));
                                            if (preg_match("#结果数约([\\d]+)个#", $html, $matches)) {
                                                $seo_info['sogou_count'] = isset($matches[1]) ? $matches[1] : 0;
                                            }
                                            if (empty($seo_info['sogou_count']) and preg_match("#找到约([\\d, ]+)条结果#", $html, $matches)) {
                                                $seo_info['sogou_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
                                            }
                                            $seo_info['sogou_count'] = empty($seo_info['sogou_count']) ? 0 : $seo_info['sogou_count'];
                                            $url = "http://www.haosou.com/s?q=site%3A{$site}";
                                            $html = Html2Text(dedeseo_http_send($url));
                                            if (preg_match("#结果数约([\\d]+)个#", $html, $matches)) {
                                                $seo_info['haosou360_count'] = isset($matches[1]) ? $matches[1] : 0;
                                            }
                                            if (empty($seo_info['haosou360_count']) and preg_match("#结果约([\\d, ]+)个#", $html, $matches)) {
                                                $seo_info['haosou360_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
                                            }
                                            $seo_info['haosou360_count'] = empty($seo_info['haosou360_count']) ? 0 : $seo_info['haosou360_count'];
                                            $in_query = "INSERT INTO `#@__plus_seoinfo` (`create_time`, `alexa_num`, `alexa_area_num`, `baidu_count`, `sogou_count`, `haosou360_count`) VALUES ({$now}, '{$seo_info['alexa_num']}', '{$seo_info['alexa_area_num']}', '{$seo_info['baidu_count']}', '{$seo_info['sogou_count']}', '{$seo_info['haosou360_count']}');";
                                            $dsql->ExecuteNoneQuery($in_query);
                                        }
                                        $inff = array('alexa_num' => 'Alexa全球排名', 'alexa_area_num' => 'Alexa地区排名', 'baidu_count' => '百度收录', 'sogou_count' => '搜狗收录', 'haosou360_count' => '360收录');
                                        ?>
<table width="100%" class="dboxtable">
    <tbody>
<?php 
开发者ID:elliotlll,项目名称:ouyaSystem,代码行数:31,代码来源:index_body.php


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