本文整理汇总了PHP中DedeTagParse::Clear方法的典型用法代码示例。如果您正苦于以下问题:PHP DedeTagParse::Clear方法的具体用法?PHP DedeTagParse::Clear怎么用?PHP DedeTagParse::Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DedeTagParse
的用法示例。
在下文中一共展示了DedeTagParse::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetOneImgUrl
function GetOneImgUrl($img, $ftype = 1)
{
if ($img != '') {
$dtp = new DedeTagParse();
$dtp->LoadSource($img);
if (is_array($dtp->CTags)) {
foreach ($dtp->CTags as $ctag) {
if ($ctag->GetName() == 'img') {
$width = $ctag->GetAtt('width');
$height = $ctag->GetAtt('height');
$imgurl = trim($ctag->GetInnerText());
$img = '';
if ($imgurl != '') {
if ($ftype == 1) {
$img .= $imgurl;
} else {
$img .= '<img src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" />';
}
}
}
}
}
$dtp->Clear();
return $img;
}
}
示例2: DedeTagParse
function __construct($cid, $aid = 0)
{
$this->ChannelInfos = '';
$this->ChannelFields = '';
$this->AllFieldNames = '';
$this->SplitPageField = '';
$this->ChannelID = $cid;
$this->ArcID = $aid;
$this->dsql = $GLOBALS['dsql'];
$sql = " Select * from `#@__channeltype` where id='{$cid}' ";
$this->ChannelInfos = $this->dsql->GetOne($sql);
if (!is_array($this->ChannelInfos)) {
echo '读取频道信息失败,无法进行后续操作!';
exit;
}
$dtp = new DedeTagParse();
$dtp->SetNameSpace('field', '<', '>');
$dtp->LoadSource($this->ChannelInfos['fieldset']);
if (is_array($dtp->CTags)) {
$tnames = array();
foreach ($dtp->CTags as $ctag) {
$tname = $ctag->GetName();
if (isset($tnames[$tname])) {
break;
}
$tnames[$tname] = 1;
if ($this->AllFieldNames != '') {
$this->AllFieldNames .= ',' . $tname;
} else {
$this->AllFieldNames .= $tname;
}
if (is_array($ctag->CAttribute->Items)) {
$this->ChannelFields[$tname] = $ctag->CAttribute->Items;
}
$this->ChannelFields[$tname]['value'] = '';
$this->ChannelFields[$tname]['innertext'] = $ctag->GetInnerText();
if (empty($this->ChannelFields[$tname]['itemname'])) {
$this->ChannelFields[$tname]['itemname'] = $tname;
}
if ($ctag->GetAtt('page') == 'split') {
$this->SplitPageField = $tname;
}
}
}
$dtp->Clear();
}
示例3: ch_specialtopic
/**
* 专题主题调用标签
*
* @version $Id: arclist.lib.php 2 8:29 2010年7月8日Z tianya $
* @package DedeCMS.Taglib
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
function ch_specialtopic($noteinfo, $arcTag, $refObj, $fname = '')
{
require_once DEDEINC . '/taglib/arclist.lib.php';
if ($noteinfo == '') {
return '';
}
$noteid = $arcTag->GetAtt('noteid');
$rvalue = '';
$tempStr = GetSysTemplets('channel_spec_note.htm');
$dtp = new DedeTagParse();
$dtp->LoadSource($noteinfo);
if (is_array($dtp->CTags)) {
foreach ($dtp->CTags as $k => $ctag) {
$notename = $ctag->GetAtt('name');
//指定名称的专题节点
if ($noteid != '' && $ctag->GetAtt('noteid') != $noteid) {
continue;
}
$isauto = $ctag->GetAtt('isauto');
$idlist = trim($ctag->GetAtt('idlist'));
$rownum = trim($ctag->GetAtt('rownum'));
$keywords = '';
$stypeid = 0;
if (empty($rownum)) {
$rownum = 40;
}
//通过关键字和栏目ID自动获取模式
if ($isauto == 1) {
$idlist = '';
$keywords = trim($ctag->GetAtt('keywords'));
$stypeid = $ctag->GetAtt('typeid');
}
$listTemplet = trim($ctag->GetInnerText()) != '' ? $ctag->GetInnerText() : GetSysTemplets('spec_arclist.htm');
$idvalue = lib_arclistDone($refObj, $ctag, $stypeid, $rownum, $ctag->GetAtt('col'), $ctag->GetAtt('titlelen'), $ctag->GetAtt('infolen'), $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), 'all', 'default', $keywords, $listTemplet, 0, $idlist, $ctag->GetAtt('channel'), '', $ctag->GetAtt('att'));
$notestr = str_replace('~notename~', $notename, $tempStr);
$notestr = str_replace('~spec_arclist~', $idvalue, $notestr);
$rvalue .= $notestr;
if ($noteid != '' && $ctag->GetAtt('noteid') == $noteid) {
break;
}
}
}
$dtp->Clear();
return $rvalue;
}
示例4: lib_productimagelist
/**
*
*
* @version $Id: productimagelist.lib.php 1 9:29 2010Äê7ÔÂ6ÈÕZ tianya $
* @package DedeCMS.Taglib
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
function lib_productimagelist(&$ctag, &$refObj)
{
global $dsql, $sqlCt;
$attlist = "desclen|80";
FillAttsDefault($ctag->CAttribute->Items, $attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
if (!isset($refObj->addTableRow['imgurls'])) {
return;
}
$revalue = '';
$innerText = trim($ctag->GetInnerText());
if (empty($innerText)) {
$innerText = GetSysTemplets('productimagelist.htm');
}
$dtp = new DedeTagParse();
$dtp->LoadSource($refObj->addTableRow['imgurls']);
$images = array();
if (is_array($dtp->CTags)) {
foreach ($dtp->CTags as $ctag) {
if ($ctag->GetName() == "img") {
$row = array();
$row['imgsrc'] = trim($ctag->GetInnerText());
$row['text'] = $ctag->GetAtt('text');
$images[] = $row;
}
}
}
$dtp->Clear();
$revalue = '';
$ctp = new DedeTagParse();
$ctp->SetNameSpace('field', '[', ']');
$ctp->LoadSource($innerText);
foreach ($images as $row) {
foreach ($ctp->CTags as $tagid => $ctag) {
if (isset($row[$ctag->GetName()])) {
$ctp->Assign($tagid, $row[$ctag->GetName()]);
}
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
示例5: DedeSql
function __construct($aid)
{
$this->dsql = new DedeSql(false);
$this->VoteInfos = $this->dsql->GetOne("Select * From #@__vote where aid='$aid'");
$this->VoteNotes = Array();
$this->VoteCount = 0;
$this->VoteID = $aid;
if(!is_array($this->VoteInfos)) return;
$dtp = new DedeTagParse();
$dtp->SetNameSpace("v","<",">");
$dtp->LoadSource($this->VoteInfos['votenote']);
if(is_array($dtp->CTags)){
foreach($dtp->CTags as $ctag){
$this->VoteNotes[$ctag->GetAtt('id')]['count'] = $ctag->GetAtt('count');
$this->VoteNotes[$ctag->GetAtt('id')]['name'] = trim($ctag->GetInnerText());
$this->VoteCount++;
}
}
$dtp->Clear();
}
示例6: array
function __construct($aid)
{
$this->dsql = $GLOBALS['dsql'];
$this->VoteInfos = $this->dsql->GetOne("SELECT * FROM `#@__vote` WHERE aid='{$aid}'");
$this->VoteNotes = array();
$this->VoteCount = 0;
$this->VoteID = $aid;
if (!is_array($this->VoteInfos)) {
return;
}
$dtp = new DedeTagParse();
$dtp->SetNameSpace("v", "<", ">");
$dtp->LoadSource($this->VoteInfos['votenote']);
if (is_array($dtp->CTags)) {
foreach ($dtp->CTags as $ctag) {
$this->VoteNotes[$ctag->GetAtt('id')]['count'] = $ctag->GetAtt('count');
$this->VoteNotes[$ctag->GetAtt('id')]['name'] = trim($ctag->GetInnerText());
$this->VoteCount++;
}
}
$dtp->Clear();
}
示例7: LoadConfig
//.........这里部分代码省略.........
$updir = str_replace("\\","/",$updir);
$updir = preg_replace("/\/{1,}/","/",$updir);
if(!is_dir($updir)) MkdirAll($updir,$GLOBALS['cfg_dir_purview']);
}
//list 配置
//要采集的列表页的信息
else if($ctag->GetName()=="list")
{
$this->List["varstart"]= $ctag->GetAtt("varstart");
$this->List["varend"] = $ctag->GetAtt("varend");
$this->List["source"] = $ctag->GetAtt("source");
$this->List["sourcetype"] = $ctag->GetAtt("sourcetype");
$dtp2->LoadString($ctag->GetInnerText());
for($j=0;$j<=$dtp2->Count;$j++)
{
$ctag2 = $dtp2->CTags[$j];
$tname = $ctag2->GetName();
if($tname=="need"){
$this->List["need"] = trim($ctag2->GetInnerText());
}else if($tname=="cannot"){
$this->List["cannot"] = trim($ctag2->GetInnerText());
}
else if($tname=="linkarea"){
$this->List["linkarea"] = trim($ctag2->GetInnerText());
}else if($tname=="url")
{
$gurl = trim($ctag2->GetAtt("value"));
//手工指定列表网址
if($this->List["source"]=="app")
{
$turl = trim($ctag2->GetInnerText());
$turls = explode("\n",$turl);
$l_tj = 0;
foreach($turls as $turl){
$turl = trim($turl);
if($turl=="") continue;
if(!eregi("^http://",$turl)) $turl = "http://".$turl;
$this->List["url"][$l_tj] = $turl;
$l_tj++;
}
}
//用分页变量产生的网址
else
{
if(eregi("var:分页",trim($ctag2->GetAtt("value")))){
if($this->List["varstart"]=="") $this->List["varstart"]=1;
if($this->List["varend"]=="") $this->List["varend"]=10;
$l_tj = 0;
for($l_em = $this->List["varstart"];$l_em<=$this->List["varend"];$l_em++){
$this->List["url"][$l_tj] = str_replace("[var:分页]",$l_em,$gurl);
$l_tj++;
}
}//if set var
else{
$this->List["url"][0] = $gurl;
}
}
}
}//End inner Loop1
}
//art 配置
//要采集的文章页的信息
else if($ctag->GetName()=="art")
{
$dtp2->LoadString($ctag->GetInnerText());
for($j=0;$j<=$dtp2->Count;$j++)
{
$ctag2 = $dtp2->CTags[$j];
//文章要采集的字段的信息及处理方式
if($ctag2->GetName()=="note"){
$field = $ctag2->GetAtt('field');
if($field == "") continue;
$this->ArtNote[$field]["value"] = $ctag2->GetAtt('value');
$this->ArtNote[$field]["isunit"] = $ctag2->GetAtt('isunit');
$this->ArtNote[$field]["isdown"] = $ctag2->GetAtt('isdown');
$dtp3->LoadString($ctag2->GetInnerText());
for($k=0;$k<=$dtp3->Count;$k++)
{
$ctag3 = $dtp3->CTags[$k];
if($ctag3->GetName()=="trim"){
$this->ArtNote[$field]["trim"][] = $ctag3->GetInnerText();
}
else if($ctag3->GetName()=="match"){
$this->ArtNote[$field]["match"] = $ctag3->GetInnerText();
}
else if($ctag3->GetName()=="function"){
$this->ArtNote[$field]["function"] = $ctag3->GetInnerText();
}
}
}
else if($ctag2->GetName()=="sppage"){
$this->ArtNote["sppage"] = $ctag2->GetInnerText();
$this->ArtNote["sptype"] = $ctag2->GetAtt('sptype');
}
}//End inner Loop2
}
}//End Loop
$dtp->Clear();
$dtp2->Clear();
}
示例8: GetFormItemValue
function GetFormItemValue($ctag, $fvalue)
{
$fieldname = $ctag->GetName();
$formitem = "\r\n\t\t<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <td width=\"80\">~name~</td>\r\n <td width=\"720\">~form~</td>\r\n </tr>\r\n </table>\r\n";
$innertext = trim($ctag->GetInnerText());
if ($innertext != "") {
if ($ctag->GetAtt("type") == 'select') {
$myformItem = '';
$items = explode(',', $innertext);
$myformItem = "<select name='{$fieldname}' style='width:150px'>";
foreach ($items as $v) {
$v = trim($v);
if ($v != '') {
if ($fvalue == $v) {
$myformItem .= "<option value='{$v}' selected>{$v}</option>\r\n";
} else {
$myformItem .= "<option value='{$v}'>{$v}</option>\r\n";
}
}
}
$myformItem .= "</select>\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $myformItem, $formitem);
return $formitem;
} else {
if ($ctag->GetAtt("type") == 'radio') {
$myformItem = '';
$items = explode(',', $innertext);
foreach ($items as $v) {
$v = trim($v);
if ($v != '') {
if ($fvalue == $v) {
$myformItem .= "<input type='radio' name='{$fieldname}' class='np' value='{$v}' checked>{$v}\r\n";
} else {
$myformItem .= "<input type='radio' name='{$fieldname}' class='np' value='{$v}'>{$v}\r\n";
}
}
}
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $myformItem, $formitem);
return $formitem;
} else {
$formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace('~form~', $innertext, $formitem);
$formitem = str_replace('@value', $fvalue, $formitem);
return $formitem;
}
}
}
//文本数据的特殊处理
if ($ctag->GetAtt("type") == "textdata") {
if (is_file($GLOBALS['cfg_basedir'] . $fvalue)) {
$fp = fopen($GLOBALS['cfg_basedir'] . $fvalue, 'r');
$okfvalue = "";
while (!feof($fp)) {
$okfvalue .= fgets($fp, 1024);
}
fclose($fp);
} else {
$okfvalue = "";
}
$formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">" . $ctag->GetAtt('itemname') . "</td>\r\n";
$formitem .= "<td>\r\n" . GetEditor($fieldname, $okfvalue, 350, 'Basic', 'string') . "</td>\r\n";
$formitem .= "</tr></table>\r\n";
$formitem .= "<input type='hidden' name='{$fieldname}_file' value='{$fvalue}'>\r\n";
return $formitem;
} else {
if ($ctag->GetAtt("type") == "htmltext") {
$formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">" . $ctag->GetAtt('itemname') . "</td>\r\n";
$formitem .= "<td>\r\n" . GetEditor($fieldname, $fvalue, 350, 'Basic', 'string') . "</td>\r\n";
$formitem .= "</tr></table>\r\n";
return $formitem;
} else {
if ($ctag->GetAtt("type") == "multitext") {
$innertext = "<textarea name='{$fieldname}' id='{$fieldname}' style='width:100%;height:80'>{$fvalue}</textarea>\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
} else {
if ($ctag->GetAtt("type") == "datetime") {
$nowtime = GetDateTimeMk($fvalue);
$innertext = "<input name=\"{$fieldname}\" value=\"{$nowtime}\" type=\"text\" id=\"{$fieldname}\" style=\"width:200\">";
$innertext .= "<input name=\"selPubtime\" type=\"button\" id=\"selkeyword\" value=\"选择\" onClick=\"showCalendar('{$fieldname}', 'Y-m-d H:i:00', '24');\">";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
} else {
if ($ctag->GetAtt("type") == "img") {
$ndtp = new DedeTagParse();
$ndtp->LoadSource($fvalue);
if (!is_array($ndtp->CTags)) {
$ndtp->Clear();
$fvalue = "";
}
$ntag = $ndtp->GetTag("img");
$fvalue = trim($ntag->GetInnerText());
$innertext = "<input type='text' name='{$fieldname}' value='{$fvalue}' id='{$fieldname}' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectImage('form1.{$fieldname}','big')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
//.........这里部分代码省略.........
示例9: DedeTagParse
$addQuery = "SELECT * FROM `{$addtable}` WHERE aid='{$aid}'";
$addRow = $dsql->GetOne($addQuery);
$newRowStart = 1;
$nForm = '';
if (isset($addRow['softlinks']) && $addRow['softlinks'] != '') {
$dtp = new DedeTagParse();
$dtp->LoadSource($addRow['softlinks']);
if (is_array($dtp->CTags)) {
foreach ($dtp->CTags as $ctag) {
if ($ctag->GetName() == 'link') {
$nForm .= "软件地址" . $newRowStart . ":<input class='text' type='text' name='softurl" . $newRowStart . "' value='" . trim($ctag->GetInnerText()) . "' />\r\n 服务器名称:<input class='text' type='text' name='servermsg" . $newRowStart . "' value='" . $ctag->GetAtt("text") . "' />\r\n <br />";
$newRowStart++;
}
}
}
$dtp->Clear();
}
$channelid = $row['channel'];
$tags = GetTags($aid);
include DEDEMEMBER . "/templets/soft_edit.htm";
exit;
} else {
if ($dopost == 'save') {
$description = '';
include DEDEMEMBER . '/inc/archives_check_edit.php';
//分析处理附加表数据
$inadd_f = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
示例10: GetImgLinks
function GetImgLinks($fvalue)
{
$revalue = "";
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if(!is_array($dtp->CTags)){
$dtp->Clear();
return "无图片信息!";
}
$ptag = $dtp->GetTag("pagestyle");
if(is_object($ptag)){
$pagestyle = $ptag->GetAtt('value');
$maxwidth = $ptag->GetAtt('maxwidth');
$ddmaxwidth = $ptag->GetAtt('ddmaxwidth');
$irow = $ptag->GetAtt('row');
$icol = $ptag->GetAtt('col');
if(empty($maxwidth)) $maxwidth = $GLOBALS['cfg_album_width'];
}else{
$pagestyle = 2;
$maxwidth = $GLOBALS['cfg_album_width'];
$ddmaxwidth = 200;
}
if($pagestyle == 3){
if(empty($irow)) $irow = 4;
if(empty($icol)) $icol = 4;
}
//遍历图片信息
$mrow = 0;
$mcol = 0;
$photoid = 0;
$images = array();
$sysimgpath = $GLOBALS['cfg_templeturl']."/sysimg";
foreach($dtp->CTags as $ctag){
if($ctag->GetName()=="img"){
$iw = $ctag->GetAtt('width');
$ih = $ctag->GetAtt('heigth');
$alt = str_replace("'","",$ctag->GetAtt('text'));
$src = trim($ctag->GetInnerText());
$ddimg = $ctag->GetAtt('ddimg');
if($iw > $maxwidth) $iw = $maxwidth;
$iw = (empty($iw) ? "" : "width='$iw'");
//全部列出式或分页式图集
if($pagestyle<3){
if($revalue==""){
if($pagestyle==2){
$playsys = "
<div class='butbox'>
<a href='$src' target='_blank' class='c1'>原始图片</a>\r\n
<a href='javascript:dPlayPre();' class='c1'>上一张</a>\r\n
<a href='javascript:dPlayNext();' class='c1'>下一张</a>\r\n
<a href='javascript:dStopPlay();' class='c1'>自动 / 暂停播放</a>\r\n
</div>\r\n";
$revalue = " {$playsys}
<div class='imgview'>\r\n
<center>
<a href='javascript:dPlayNext();'><img src='$src' alt='$alt'/></a>\r\n
</center>
</div>\r\n
<script language='javascript'>dStartPlay();</script>\r\n";
}
else $revalue = "
<div class='imgview'>\r\n
<center>
<a href='$src' target='_blank'><img src='$src' alt='$alt' /></a>\r\n
</center>
</div>\r\n";
}else{
if($pagestyle==2){
$playsys = "
<div class='butbox'>
<a href='$src' target='_blank' class='c1'>原始图片</a>\r\n
<a href='javascript:dPlayPre();' class='c1'>上一张</a>\r\n
<a href='javascript:dPlayNext();' class='c1'>下一张</a>\r\n
<a href='javascript:dStopPlay();' class='c1'>自动 / 暂停播放</a>\r\n
</div>\r\n";
$revalue .= "#p#分页标题#e# {$playsys}
<div class='imgview'>\r\n
<center>
<a href='javascript:dPlayNext();'><img src='$src' alt='$alt'/></a>\r\n
</center>
</div>\r\n
<script language='javascript'>dStartPlay();</script>\r\n";
}
else $revalue .= "
<div class='imgview'>\r\n
<center>
<a href='$src' target='_blank'><img src='$src' alt='$alt' /></a>\r\n
</center>
</div>\r\n";
}
//多列式图集
}else if($pagestyle==3){
$images[$photoid][0] = $src;
$images[$photoid][1] = $alt;
$images[$photoid][2] = $ddimg;
$photoid++;
}
}
}
//.........这里部分代码省略.........
示例11: ch_softlinks_all
function ch_softlinks_all($fvalue, &$ctag, &$refObj, &$row)
{
global $dsql, $cfg_phpurl;
$phppath = $cfg_phpurl;
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if (!is_array($dtp->CTags)) {
$dtp->Clear();
return "无链接信息!";
}
$tempStr = GetSysTemplets('channel_downlinks.htm');
$downlinks = '';
foreach ($dtp->CTags as $ctag) {
if ($ctag->GetName() == 'link') {
$link = trim($ctag->GetInnerText());
$serverName = trim($ctag->GetAtt('text'));
$islocal = trim($ctag->GetAtt('islocal'));
//分析本地链接
if (!isset($firstLink) && $islocal == 1) {
$firstLink = $link;
}
if ($islocal == 1 && $row['islocal'] != 1) {
continue;
}
//支持http,迅雷下载,ftp,flashget
if (!eregi('^http://|^thunder://|^ftp://|^flashget://', $link)) {
$link = $GLOBALS['cfg_mainsite'] . $link;
}
$downloads = getDownloads($link);
$uhash = substr(md5($link), 0, 24);
if ($row['gotojump'] == 1) {
$link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}";
}
$temp = str_replace("~link~", $link, $tempStr);
$temp = str_replace("~server~", $serverName, $temp);
$temp = str_replace("~downloads~", $downloads, $temp);
$downlinks .= $temp;
}
}
$dtp->Clear();
//获取镜像功能的地址
//必须设置为:[根据本地地址和服务器列表自动生成] 的情况
$linkCount = 1;
if ($row['ismoresite'] == 1 && $row['moresitedo'] == 1 && trim($row['sites']) != '' && isset($firstLink)) {
$firstLink = eregi_replace("http://([^/]*)/", '/', $firstLink);
$row['sites'] = ereg_replace("[\r\n]{1,}", "\n", $row['sites']);
$sites = explode("\n", trim($row['sites']));
foreach ($sites as $site) {
if (trim($site) == '') {
continue;
}
list($link, $serverName) = explode('|', $site);
$link = trim(ereg_replace("/\$", "", $link)) . $firstLink;
$downloads = getDownloads($link);
$uhash = substr(md5($link), 0, 24);
if ($row['gotojump'] == 1) {
$link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}";
}
$temp = str_replace("~link~", $link, $tempStr);
$temp = str_replace("~server~", $serverName, $temp);
$temp = str_replace("~downloads~", $downloads, $temp);
$downlinks .= $temp;
}
}
return $downlinks;
}
示例12: LoadItemConfig
/**
* 分析采集文章页的字段的设置
*
* @access public
* @param string $configString 配置字符串
* @return void
*/
function LoadItemConfig($configString)
{
$dtp = new DedeTagParse();
$dtp2 = new DedeTagParse();
$dtp->LoadString($configString);
for ($i = 0; $i <= $dtp->Count; $i++) {
$ctag = $dtp->CTags[$i];
if ($ctag->GetName() == 'sppage') {
$this->artNotes['sppage'] = $ctag->GetInnerText();
$this->artNotes['sptype'] = $ctag->GetAtt('sptype');
$this->spNotes['srul'] = $ctag->GetAtt('srul');
$this->spNotes['erul'] = $ctag->GetAtt('erul');
} else {
if ($ctag->GetName() == 'previewurl') {
$this->artNotes['previewurl'] = $ctag->GetInnerText();
} else {
if ($ctag->GetName() == 'keywordtrim') {
$this->artNotes['keywordtrim'] = $ctag->GetInnerText();
} else {
if ($ctag->GetName() == 'descriptiontrim') {
$this->artNotes['descriptiontrim'] = $ctag->GetInnerText();
} else {
if ($ctag->GetName() == 'item') {
$field = $ctag->GetAtt('field');
if ($field == '') {
continue;
}
$this->artNotes[$field]['value'] = $ctag->GetAtt('value');
$this->artNotes[$field]['isunit'] = $ctag->GetAtt('isunit');
$this->artNotes[$field]['isdown'] = $ctag->GetAtt('isdown');
$this->artNotes[$field]['trim'] = array();
$this->artNotes[$field]['match'] = '';
$this->artNotes[$field]['function'] = '';
$t = 0;
$dtp2->LoadString($ctag->GetInnerText());
for ($k = 0; $k <= $dtp2->Count; $k++) {
$ctag2 = $dtp2->CTags[$k];
if ($ctag2->GetName() == 'trim') {
$this->artNotes[$field]['trim'][$t][0] = str_replace('#n#', ' ', $ctag2->GetInnerText());
$this->artNotes[$field]['trim'][$t][1] = $ctag2->GetAtt('replace');
$t++;
} else {
if ($ctag2->GetName() == 'match') {
$this->artNotes[$field]['match'] = str_replace('#n#', ' ', $ctag2->GetInnerText());
} else {
if ($ctag2->GetName() == 'function') {
$this->artNotes[$field]['function'] = $ctag2->GetInnerText();
}
}
}
}
}
}
}
}
}
}
//End Loop
$dtp->Clear();
$dtp2->Clear();
}
示例13: GetlitImgLinks
/**
* 获取缩略图链接
*
* @access public
* @param string $fvalue 表单值
* @return string
*/
function GetlitImgLinks($fvalue)
{
if ($GLOBALS["htmltype"] == "dm") {
if (empty($GLOBALS["pageno"])) {
$NowPage = 1;
} else {
$NowPage = intval($GLOBALS["pageno"]);
}
} else {
if (empty($GLOBALS["stNowPage"])) {
$NowPage = 1;
} else {
$NowPage = intval($GLOBALS["stNowPage"]);
}
}
$revalue = "";
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if (!is_array($dtp->CTags)) {
$dtp->Clear();
return "无图片信息!";
}
$ptag = $dtp->GetTag("pagestyle");
if (is_object($ptag)) {
$pagestyle = $ptag->GetAtt('value');
$maxwidth = $ptag->GetAtt('maxwidth');
$ddmaxwidth = $ptag->GetAtt('ddmaxwidth');
$irow = $ptag->GetAtt('row');
$icol = $ptag->GetAtt('col');
if (empty($maxwidth)) {
$maxwidth = $GLOBALS['cfg_album_width'];
}
} else {
$pagestyle = 2;
$maxwidth = $GLOBALS['cfg_album_width'];
$ddmaxwidth = 200;
}
if ($pagestyle == 3) {
if (empty($irow)) {
$irow = 4;
}
if (empty($icol)) {
$icol = 4;
}
}
$mrow = 0;
$mcol = 0;
$photoid = 1;
$images = array();
$TotalPhoto = sizeof($dtp->CTags);
foreach ($dtp->CTags as $ctag) {
if ($ctag->GetName() == "img") {
$iw = $ctag->GetAtt('width');
$ih = $ctag->GetAtt('heigth');
$alt = str_replace("'", "", $ctag->GetAtt('text'));
$src = trim($ctag->GetInnerText());
$ddimg = $ctag->GetAtt('ddimg');
if ($iw > $maxwidth) {
$iw = $maxwidth;
}
$iw = empty($iw) ? "" : "width='{$iw}'";
if ($GLOBALS["htmltype"] == "dm") {
$imgurl = "view.php?aid={$this->ArcID}&pageno={$photoid}";
} else {
if ($photoid == 1) {
$imgurl = $GLOBALS["fileFirst"] . ".html";
} else {
$imgurl = $GLOBALS["fileFirst"] . "_" . $photoid . ".html";
}
}
$imgcls = "image" . ($photoid - 1);
$revalue .= "<dl><dt>{$alt}<dd>{$ddimg}<dd>{$ddimg}<dd>{$ddimg}<dd><dd><div></div><div></div><dd><dd>{$photoid}</dd></dl>\r\n";
$photoid++;
}
}
unset($dtp);
unset($images);
return $revalue;
}
示例14: ch_img
/**
* 图像标签
*
* @version $Id:img.lib.php 1 9:33 2010年7月8日Z tianya $
* @package DedeCMS.Taglib
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
function ch_img($fvalue, &$arcTag, &$refObj, $fname = '')
{
global $cfg_album_width, $cfg_album_row, $cfg_album_col, $cfg_album_pagesize, $cfg_album_style, $cfg_album_ddwidth, $cfg_basehost, $cfg_multi_site;
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if (!is_array($dtp->CTags)) {
$dtp->Clear();
return "无图片信息!";
}
$pagestyle = $cfg_album_style;
$maxwidth = $cfg_album_width;
$ddmaxwidth = $cfg_album_ddwidth;
$pagepicnum = $cfg_album_pagesize;
$row = $cfg_album_row;
$icol = $cfg_album_col;
$ptag = $dtp->GetTag('pagestyle');
if (is_object($ptag)) {
$pagestyle = $ptag->GetAtt('value');
$maxwidth = $ptag->GetAtt('maxwidth');
$ddmaxwidth = $ptag->GetAtt('ddmaxwidth');
$pagepicnum = $ptag->GetAtt('pagepicnum');
$irow = $ptag->GetAtt('row');
$icol = $ptag->GetAtt('col');
if (empty($maxwidth)) {
$maxwidth = $cfg_album_width;
}
}
//遍历图片信息
$mrow = 0;
$mcol = 0;
$images = array();
$innerTmp = $arcTag->GetInnerText();
if (trim($innerTmp) == '') {
$innerTmp = GetSysTemplets("channel_article_image.htm");
}
if ($pagestyle == 1) {
$pagesize = $pagepicnum;
} else {
if ($pagestyle == 2) {
$pagesize = 1;
} else {
$pagesize = $irow * $icol;
}
}
if (is_object($arcTag) && $arcTag->GetAtt('pagesize') > 0) {
$pagesize = $arcTag->GetAtt('pagesize');
}
if (empty($pagesize)) {
$pagesize = 12;
}
$aid = $refObj->ArcID;
$row = $refObj->dsql->GetOne("SELECT title FROM `#@__archives` WHERE `id` = '{$aid}';");
$title = $row['title'];
$revalue = '';
$GLOBAL['photoid'] = 0;
foreach ($dtp->CTags as $ctag) {
if ($ctag->GetName() == "img") {
$fields = $ctag->CAttribute->Items;
$fields['text'] = str_replace("'", "", $ctag->GetAtt('text'));
$fields['title'] = $title;
$fields['imgsrc'] = trim($ctag->GetInnerText());
$fields['imgsrctrue'] = $fields['imgsrc'];
if (empty($fields['ddimg'])) {
$fields['ddimg'] = $fields['imgsrc'];
}
if ($cfg_multi_site == 'Y') {
//$cfg_basehost)
if (!preg_match('#^http:#i', $fields['imgsrc'])) {
$fields['imgsrc'] = $cfg_basehost . $fields['imgsrc'];
}
if (!preg_match('#^http:#i', $fields['ddimg'])) {
$fields['ddimg'] = $cfg_basehost . $fields['ddimg'];
}
}
if (empty($fields['width'])) {
$fields['width'] = $maxwidth;
}
//if($fields['text']=='')
//{
//$fields['text'] = '图片'.($GLOBAL['photoid']+1);
//}
$fields['alttext'] = str_replace("'", '', $fields['text']);
$fields['pagestyle'] = $pagestyle;
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field", "[", "]");
$dtp2->LoadSource($innerTmp);
if ($GLOBAL['photoid'] > 0 && $GLOBAL['photoid'] % $pagesize == 0) {
$revalue .= "#p#分页标题#e#";
}
if ($pagestyle == 1) {
$fields['imgwidth'] = '';
//.........这里部分代码省略.........
示例15: Display
function Display($modfile = "")
{
global $cfg_templets_dir, $wecome_info, $cfg_basedir;
if (empty($wecome_info)) {
$wecome_info = "DedeCms OX 通用对话框:";
}
$ctp = new DedeTagParse();
if ($modfile == '') {
$ctp->LoadTemplate($cfg_basedir . $cfg_templets_dir . '/plus/win_templet.htm');
} else {
$ctp->LoadTemplate($modfile);
}
$emnum = $ctp->Count;
for ($i = 0; $i <= $emnum; $i++) {
if (isset($GLOBALS[$ctp->CTags[$i]->GetTagName()])) {
$ctp->Assign($i, $GLOBALS[$ctp->CTags[$i]->GetTagName()]);
}
}
$ctp->Display();
$ctp->Clear();
}