本文整理汇总了PHP中util::getfirstimg方法的典型用法代码示例。如果您正苦于以下问题:PHP util::getfirstimg方法的具体用法?PHP util::getfirstimg怎么用?PHP util::getfirstimg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util
的用法示例。
在下文中一共展示了util::getfirstimg方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dodefault
function dodefault()
{
$len = strlen('plugin-momo-momo-default-');
$title = substr($_SERVER['QUERY_STRING'], $len);
$title = urldecode($title);
$title = trim($title);
$title2 = $title;
$title = urldecode($title);
if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
$title = string::hiconv($title, $to = 'gbk', $from = 'utf-8');
}
$doc = $_ENV['momo']->get_doc_by_title($title);
if ($doc) {
$doc['image'] = util::getfirstimg($doc['content']);
$momourl = trim($this->plugin[momo][vars][momourl]);
if ($momourl) {
$doc['url'] = $momourl . "index.php?doc-view-" . $doc['did'] . $this->setting['seo_suffix'];
} else {
$doc['url'] = $this->setting['site_url'] . "/" . $this->setting['seo_prefix'] . "doc-view-" . $doc['did'] . $this->setting['seo_suffix'];
}
$doc_exists = 1;
} else {
$url = 'http://www.hudong.com/validateDocSummary.do?doc_title=' . $title2;
$data = util::hfopen($url);
$doc_exists = 1;
if ($data && stripos($data, '<flag>true</flag>') && preg_match_all("/<\\!\\[CDATA\\[(.*)\\]\\]>/", $data, $matches)) {
$summary = $matches[1][1];
$image = $matches[1][2];
if ($summary == 'null') {
$summary = '';
}
if ($image == 'null') {
$image = '';
}
if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
$summary = string::hiconv($summary, $to = 'gbk', $from = 'utf-8');
}
$doc = array('image' => $image, 'url' => 'http://www.hudong.com/wiki/' . $title, 'summary' => $summary);
} else {
$doc_exists = 0;
}
}
$this->view->assign("doc_exists", $doc_exists);
$this->view->assign("doc", $doc);
$this->view->assign("encode", WIKI_CHARSET);
$this->view->assign("title", $title);
$this->view->display('file://plugins/momo/view/momo');
}
示例2: edit_feed
function edit_feed($doc)
{
$isimg = util::getfirstimg($doc[content]);
if (false !== strpos($isimg, "http://")) {
$img = empty($isimg) ? "" : $isimg;
} else {
$img = empty($isimg) ? "" : WIKI_URL . "/" . $isimg;
}
$feed = unserialize($this->base->setting[feed]);
$uid = $this->base->user[uid];
if (@in_array("edit", $feed)) {
$feed = array();
$feed["icon"] = "post";
$feed["type"] = "edit";
$feed["title_data"] = array("title" => "<a href=\\\"" . WIKI_URL . "/{$this->base->setting[seo_prefix]}doc-view-{$doc['did']}{$this->base->setting[seo_suffix]}\\\">{$doc['title']}</a>", "author" => "<a href=\\\"space.php?uid={$uid}\\\">{$this->base->user['username']}</a>", "app" => $this->base->setting["site_name"]);
$feed["body_data"] = array("subject" => "<a href=\\\"" . WIKI_URL . "/{$this->base->setting[seo_prefix]}doc-view-{$doc['did']}{$this->base->setting[seo_suffix]}\\\">{$doc['title']}</a>", "message" => $doc["summary"]);
$feed["images"][] = array("url" => "{$img}", "link" => WIKI_URL . "/{$this->base->setting[seo_prefix]}doc-view-{$doc['did']}{$this->base->setting[seo_suffix]}");
$this->postfeed($feed);
}
}
示例3: doupdateimg
function doupdateimg()
{
if (!empty($this->post['did']) && is_array($this->post['did'])) {
foreach ($this->post['did'] as $did) {
$doc = $this->db->fetch_by_field('doc', 'did', $did);
if (is_array($doc)) {
$img = $_ENV['doc']->setfocusimg(util::getfirstimg($doc['content']));
if ($img != '') {
$doc = $this->db->update_field('focus', 'image', $img, "did={$did}");
}
}
}
}
$this->cache->removecache('data_' . $GLOBALS['theme'] . '_index');
if (isset($this->get[2])) {
$searchdata = $this->get[2];
$searchdata = str_replace(',', '-', $searchdata);
$this->header(urldecode($searchdata));
} else {
$this->header("admin_focus-focuslist");
}
}
示例4: set_focus_doc
function set_focus_doc($dids, $doctype)
{
$doclist = $this->get_doc_by_ids($dids);
foreach ($doclist as $key => $doc) {
$title = string::haddslashes($doc['rawtitle'], 1);
$tag = string::haddslashes($this->jointags($doc['tag']), 1);
if ($doctype == 2) {
$summary = trim(string::convercharacter(string::substring(strip_tags($doc['content']), 0, 30)));
} elseif ($doctype == 3) {
$summary = trim(string::convercharacter(string::substring(strip_tags($doc['content']), 0, 80)));
} else {
$summary = trim(string::convercharacter(string::substring(strip_tags($doc['content']), 0, 100)));
}
$summary = string::haddslashes($summary, 1);
$image = $this->setfocusimg(util::getfirstimg($doc['content']));
$this->db->query("REPLACE INTO " . DB_TABLEPRE . "focus (did,title,tag,summary,image,time,type)VALUES (" . $doc['did'] . ",'{$title}','{$tag}','{$summary}','{$image}','" . $this->base->time . "','{$doctype}')");
}
return true;
}
示例5: dosummary
function dosummary()
{
$count = count($this->get);
@($title = $this->get[2]);
for ($i = 3; $i < $count; $i++) {
$title .= '-' . $this->get[$i];
}
$title = trim($title);
$title2 = $title;
$title = urldecode($title);
if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
$title = string::hiconv($title, $to = 'gbk', $from = 'utf-8');
}
$doc = $this->db->fetch_by_field('doc', 'title', addslashes($title));
if ((bool) $doc) {
$doc['image'] = util::getfirstimg($doc['content']);
$doc['url'] = WIKI_URL . "/" . $this->setting['seo_prefix'] . "doc-view-" . $doc['did'] . $this->setting['seo_suffix'];
$doc_exists = 1;
} else {
$url = 'http://www.hudong.com/validateDocSummary.do?doc_title=' . $title2;
$data = util::hfopen($url);
$doc_exists = 1;
if ($data && stripos($data, '<flag>true</flag>') && preg_match_all("/<\\!\\[CDATA\\[(.*)\\]\\]>/", $data, $matches)) {
$summary = $matches[1][1];
$image = $matches[1][2];
if ($summary == 'null') {
$summary = '';
}
if ($image == 'null') {
$image = '';
}
$doc = array('image' => $image, 'url' => 'http://www.hudong.com/wiki/' . $title2, 'summary' => $summary);
} else {
$doc_exists = 0;
}
}
$this->view->assign("doc_exists", $doc_exists);
$this->view->assign("doc", $doc);
$this->view->assign("encode", WIKI_CHARSET);
$this->view->assign("title", $title);
//$this->view->display('hdmomo');
$_ENV['block']->view('hdmomo');
}
示例6: getfirstimg
function getfirstimg(&$content)
{
$doc_firstimg = util::getfirstimg($content);
if (!empty($doc_firstimg)) {
if (stripos($doc_firstimg, "http") !== false) {
$doc_firstimg = '<img src="' . $doc_firstimg . '" class="firstimg" alt="" />';
} else {
$doc_firstimg = '<img src="' . WIKI_URL . '/' . $doc_firstimg . '" class="firstimg" alt="" />';
}
}
return $doc_firstimg;
}