function get_chapters_from_mangapanda($config = array()) { $chapters_url = trim(__ARRAY_VALUE($config, 'chapters_url', '')); if ($chapters_url == '') { return false; } $content = fetch_url_content($chapters_url); if (!$content) { return false; } $slug = __ARRAY_VALUE($config, 'slug'); preg_match_all('%<a.*?href="(/' . $slug . '/[^"]+)".*?>(.*?)</a>%sim', $content, $result, PREG_PATTERN_ORDER); $urls = $result[1]; $titles = $result[2]; $chapters = array(); for ($i = 0; $i < count($urls); $i += 1) { $url = $urls[$i]; if (preg_match('%^/' . $slug . '/(.*?)$%sim', $url, $regs)) { $chapter_id = $regs[1]; $chapters[$chapter_id] = array('url' => 'http://www.mangapanda.com' . $url, 'title' => $titles[$i]); } } ksort($chapters, SORT_NUMERIC); return $chapters; }
/** * get partial chapters list * * @param array $statusData * * @return array|mixed */ function getPartialChaptersList(&$statusData = array()) { if (!is_array($statusData)) { $statusData = array(); } $list = __ARRAY_VALUE($statusData, 'chapters/partialChapters', array()); if (!is_array($list)) { $list = array(); } return $list; }