function getTreeView(array $roots, $ind) { $tree = ''; foreach ($roots as $branch) { $closed = true; if (isset($_SESSION['tree']) && isset($_SESSION['tree'][$branch->getId()])) { $closed = $_SESSION['tree'][$branch->getId()] === 'closed'; } $tree .= $ind . '<dl tag-id="' . $branch->getId() . '" class="tree' . ($closed ? ' closed' : '') . '">' . PHP_EOL; $tree .= $ind . ' ' . '<dt>' . getTagLinks($branch) . '</dt>' . PHP_EOL; $tree .= $ind . ' ' . '<dd>' . PHP_EOL; $tree .= getTreeView($branch->getChildren(), $ind . ' '); $tree .= $ind . ' ' . '</dd>' . PHP_EOL; $tree .= $ind . '</dl>' . PHP_EOL; } return $tree; }
function PageCompFileInfo() { global $site; global $aFile; if ($aFile['medCount'] - 1 > 0) { $sLinkMore = '<a href="browseVideo.php?userID=' . $aFile['medProfId'] . '">' . $aFile['medCount'] . '</a>'; } else { $sLinkMore = $aFile['medCount']; } $sTitle = strlen($aFile['medTitle']) > 0 ? $aFile['medTitle'] : _t("_Untitled"); $sCode .= '<div id="videoInfo">'; $sCode .= '<div id="fileTop">'; $sCode .= '<div class="fileTitle">' . $sTitle . '</div>'; $sCode .= '<div class="userPic">' . get_member_icon($aFile['medProfId'], 'left') . '</div>'; $sCode .= '<div class="fileUserInfo"><a href="' . getProfileLink($aFile['medProfId']) . '">' . $aFile['NickName'] . '</a></div>'; $sCode .= '<div>' . _t("_Videos") . ': <b>' . $sLinkMore . '</b></div>'; $sCode .= '</div>'; $sCode .= '<div class="clear_both"></div>'; $sCode .= '<div id="serviceInfo">'; $sCode .= '<div>' . _t("_Added") . ': <b>' . defineTimeInterval($aFile['medDate']) . '</b></div>'; $sCode .= '<div>' . _t("_Views") . ': ' . $aFile['medViews'] . '</div>'; $sCode .= '<div>' . _t("_URL") . ': <input type="text" onClick="this.focus(); this.select();" readonly="true" value="' . $site['url'] . 'viewVideo.php?fileID=' . $aFile['medID'] . '"/></div>'; $sCode .= '<div>' . _t("_Embed") . ' : <input type="text" onClick="this.focus(); this.select();" readonly="true" value="' . htmlspecialchars(getEmbedCode('movie', 'player', array('file' => $aFile['medID']))) . '"></div>'; $sCode .= '<div>' . _t("_Tags") . ': ' . getTagLinks($aFile['medTags'], 'Video') . '</div>'; $sCode .= '<div>' . _t("_DescriptionMedia") . ': ' . $aFile['medDesc'] . '</div>'; $sCode .= '</div>'; $sCode .= '</div>'; return $sCode; }
<?php die; /** * */ set_time_limit(0); error_reporting(E_ALL); ini_set('display_errors', 'On'); header("Content-type: text/html; charset=gb2312"); $baseUrl = 'http://info.stockstar.com/info/dic/'; $pagerLink = 'http://info.stockstar.com/info/dic/left2.htm'; $linkTxt = 'tag.txt'; $articleLinks = array(); $tagLinks = getTagLinks($pagerLink); //echo '<pre>';print_r($tagLinks);echo '</pre>'; writeToTxt($tagLinks); function getTagLinks($pagerLink) { $tagLinks = array(); $listPattern = '/<div class=clSub>[\\s\\S]*?<\\/div>/i'; $linkPattern = '/<a href="(.*?)"[^>]*>.*?<\\/a>/i'; $content = file_get_contents($pagerLink); preg_match($listPattern, $content, $matches); $listContent = $matches[0]; if ($listContent) { preg_match_all($linkPattern, $listContent, $matches); $tagLinks = $matches[1]; } return $tagLinks; }