function parsePerson($url) { correctConfigForParser(); preg_match("/^(http:\\/\\/)?([^\\/]+)/i", $url, $matches); $host = $matches[2]; preg_match("/[^\\.\\/]+\\.[^\\.\\/]+\$/", $host, $matches); $where = $matches[0]; $res = array(); switch ($where) { case "imdb.com": case "world-art.ru": case "kinopoisk.ru": case "ozon.ru": list($module) = explode(".", $where); require_once dirname(__FILE__) . "/common/webparser/webparser.php"; global $config; $web_parser = new WebParser($config['websites'], $config['customer']); $results = $web_parser->Parse($module, 'person', array('path' => $url)); //echo "<pre>" . print_r($results,true) . "</pre>"; $rusname = ''; $engname = ''; foreach ($results['names'] as $name) { if (!$rusname && lms_rus_eng_detect($name) == 'rus') { $rusname = $name; } if (!$engname && lms_rus_eng_detect($name) != 'rus') { $engname = adapt1252To1251(html2ASCII($name)); } } $res["RusName"] = $rusname; $res["OriginalName"] = $engname; $adaptDate = array('January' => 'января', 'February' => 'февраля', 'March' => 'марта', 'April' => 'апреля', 'May' => 'мая', 'June' => 'июня', 'July' => 'июля', 'August' => 'августа', 'September' => 'сентября', 'October' => 'октября', 'November' => 'ноября', 'December' => 'декабря'); $res["Born"] = $results['born_date']; if (isset($results['born_place'])) { $res["Born"] .= " ({$results['born_place']}) "; } $res["Profile"] = strtolower($results['profile']); $res["About"] = $results['about']; if (isset($config['allowable_tags'])) { $res["About"] = strip_tags($res["About"], $config['allowable_tags']); } $res["Photos"] = $results['photos']; return $res; break; } }
function best_comment($ThisFileInfo, $tag, $default = '') { $cur = 0; $ret_string = $default; if (isset($ThisFileInfo['comments'][$tag])) { foreach ($ThisFileInfo['comments'][$tag] as $value) { $value = magic_decode($value); if (strlen($value) > $cur) { $ret_string = $value; $cur = strlen($value); } } } if (isset($ThisFileInfo['comments_html'][$tag])) { foreach ($ThisFileInfo['comments_html'][$tag] as $value) { $value = html2ASCII($value); if (strlen($value) > $cur) { $ret_string = $value; $cur = strlen($value); } } } return $ret_string; }