function AppCode(&$str) { if ($this->moduleLang == $this->sysLang) { return $str; } else { if ($this->sysLang == 'utf-8') { if ($this->moduleLang == 'gbk') { return gb2utf8($str); } if ($this->moduleLang == 'big5') { return gb2utf8(big52gb($str)); } } else { if ($this->sysLang == 'gbk') { if ($this->moduleLang == 'utf-8') { return utf82gb($str); } if ($this->moduleLang == 'big5') { return big52gb($str); } } else { if ($this->sysLang == 'big5') { if ($this->moduleLang == 'utf-8') { return gb2big5(utf82gb($str)); } if ($this->moduleLang == 'gbk') { return gb2big5($str); } } else { return $str; } } } } }
private function parse_title_info() { try { $info = array(); $info['stop_renew'] = !preg_match('/漫畫狀態:(?:<\\/b><b class="red">)?連載/', $this->html); preg_match('/<div class="cCon">([^<]+)/', $this->html, $result); $info['intro'] = trim(strip_tags(gb2big5($result[1]), '<br>')); if (preg_match('/漫畫作者:(?:<\\/b>)?(?:<a[^>]+>)?([^<]+)</', $this->html, $result)) { $info['author_id'] = $this->CI->grab->get_author_id($result[1]); } else { $info['author_id'] = null; } preg_match("/<h1><a title='[^']+' href='\\/comic\\/99(\\d+)\\/'>([^<]+)/", $this->html, $result); $info['index'] = $result[1]; $info['name'] = gb2big5($result[2]); preg_match("/<div class=\"block\"><img alt='[^']+' src='http:\\/\\/img.99mh.com([^']+)/", $this->html, $result); $info['meta'] = json_encode(['thumbnail' => $result[1]]); return $info; } catch (Exception $e) { throw new Exception("Parse title info error"); } }
private function get_title_info() { $titles = []; if (!preg_match_all('/<a href="\\/colist_(\\d+).html"[^>]+>([^<]+)</', $this->html, $title_infos, PREG_SET_ORDER)) { elog('site_xxbh - Error Title Parsing.'); } else { if (!preg_match_all('/img src="([^"]+)" alt/', $this->html, $imgs)) { elog('site_xxbh - Error Title Image Parsing.'); } else { foreach ($imgs[1] as $i => $img) { $row = []; list(, $row['index'], $row['title']) = $title_infos[$i]; $row['title'] = gb2big5($row['title']); $row['image'] = $img; $titles[] = $row; } } } return $titles; }