if (preg_match('/^http\\:\\/\\/(.*?)imdb\\.com\\/title\\/tt([\\d]{7})/i', $torrents['url'], $imdb_tmp)) { $imdb_id = $imdb_tmp[2]; unset($imdb_tmp); if (!($imdb_html = $mc1->get_value('imdb::' . $imdb_id))) { $movie = new imdb($imdb_id); $movie->setid($imdb_id); $imdb_data['director'] = $movie->director(); $imdb_data['writing'] = $movie->writing(); $imdb_data['producer'] = $movie->producer(); $imdb_data['composer'] = $movie->composer(); $imdb_data['cast'] = $movie->cast(); $imdb_data['cast'] = array_slice($imdb_data['cast'], 0, 10); $imdb_data['genres'] = $movie->genres(); $imdb_data['plot'] = $movie->plot(); $imdb_data['plotoutline'] = $movie->plotoutline(); $imdb_data['trailers'] = $movie->trailers(); $imdb_data['language'] = $movie->language(); $imdb_data['rating'] = $movie->rating(); $imdb_data['title'] = $movie->title(); $imdb_data['year'] = $movie->year(); $imdb_data['runtime'] = $movie->runtime(); $imdb_data['votes'] = $movie->votes(); $imdb_data['country'] = $movie->country(); $imdb = array('country' => 'Country', 'director' => 'Directed by', 'writing' => 'Writing by', 'producer' => 'Produced by', 'cast' => 'Cast', 'plot' => 'Description', 'composer' => 'Music', 'genres' => 'All genres', 'plotoutline' => 'Plot outline', 'trailers' => 'Trailers', 'language' => 'Language', 'rating' => 'Rating', 'title' => 'Title', 'year' => 'Year', 'runtime' => 'Runtime', 'votes' => 'Votes'); foreach ($imdb as $foo => $boo) { if (isset($imdb_data[$foo]) && !empty($imdb_data[$foo])) { if (!is_array($imdb_data[$foo])) { $imdb_html .= "<span style='font-weight:bold;color:#800517'>" . $boo . ":</span> " . $imdb_data[$foo] . "<br />\n"; } elseif (is_array($imdb_data[$foo]) && in_array($foo, array('director', 'writing', 'producer', 'composer', 'cast', 'trailers'))) { foreach ($imdb_data[$foo] as $pp) { if ($foo == 'cast') {
} # Selected User Comment $comment = $movie->comment(); if (!empty($comment)) { ++$rows; echo "<tr><td valign='top'><b>User Comments:</b></td><td>{$comment}</td></tr>\n"; } # Quotes $quotes = $movie->quotes(); if (!empty($quotes)) { ++$rows; echo '<tr><td valign=top><b>Movie Quotes:</b></td><td>'; echo preg_replace("/http\\:\\/\\/" . str_replace(".", "\\.", $movie->imdbsite) . "\\/name\\/nm(\\d{7})\\//", "person.php?mid=\\1", $quotes[0]) . "</td></tr>\n"; } # Trailer $trailers = $movie->trailers(); if (!empty($trailers)) { ++$rows; echo '<tr><td valign=top><b>Trailers:</b></td><td>'; for ($i = 0; $i < count($trailers); ++$i) { echo "<a href='" . $trailers[$i] . "'>" . $trailers[$i] . "</a><br>\n"; } echo "</td></tr>\n"; } # Crazy Credits $crazy = $movie->crazy_credits(); $cc = count($crazy); if ($cc) { ++$rows; echo '<tr><td valign=top><b>Crazy Credits:</b></td><td>'; echo "We know about {$cc} <i>Crazy Credits</i>. One of them reads:<br>{$crazy['0']}</td></tr>\n";
/** Get all possible trailers * @method getAllTrailers * @param string mid IMDB ID * @return array [0..n] of array[url,format] of movie trailers */ function getAllTrailers($mid) { $movie = new imdb($mid); $arraytrailers = $movie->trailers(); $list = array(); foreach ($arraytrailers as $url) { unset($tl); $tmp = strtolower($url); if (strpos($tmp, "www.moviemaze.de") !== FALSE) { $tl = $this->getFlashCodeMovieMaze($url); } elseif (strpos($tmp, "alltrailers.net") !== FALSE) { $tl = $this->getFlashCodeAllTrailers($url); } elseif (strpos($url, "imdb.com/rg/VIDEO_TITLE/GALLERY") !== FALSE) { $tl = $this->getImdbTrailers($url); } elseif (strpos($tmp, "www.movieplayer.it") !== FALSE) { $tl = $this->getMoviePlayerTrailers($url); } elseif (strpos($tmp, "azmovietrailers.com") !== FALSE) { $tl = $this->getAZMovieTrailers($url); } if (isset($tl)) { $list = array_merge($list, $tl); } } return $list; }
} # Selected User Comment $comment = $movie->comment(); if (!empty($comment)) { ++$rows; echo "<tr><td valign='top'><b>User Comments:</b></td><td>{$comment}</td></tr>\n"; } # Quotes $quotes = $movie->quotes(); if (!empty($quotes)) { ++$rows; echo '<tr><td valign=top><b>Movie Quotes:</b></td><td>'; echo preg_replace("/http\\:\\/\\/" . str_replace(".", "\\.", $movie->imdbsite) . "\\/name\\/nm(\\d{7})\\//", "person.php?engine={$engine}&mid=\\1", $quotes[0]) . "</td></tr>\n"; } # Trailer $trailers = $movie->trailers(TRUE); if (!empty($trailers)) { ++$rows; echo '<tr><td valign=top><b>Trailers:</b></td><td>'; for ($i = 0; $i < count($trailers); ++$i) { if (!empty($trailers[$i]['url'])) { echo "<a href='" . $trailers[$i]['url'] . "'>" . $trailers[$i]['title'] . "</a><br>\n"; } } echo "</td></tr>\n"; } # Crazy Credits $crazy = $movie->crazy_credits(); $cc = count($crazy); if ($cc) { ++$rows;
function get_imdb($imdburl) { global $INSTALLER09, $mc1; $imdb_info['id'] = $imdb_info['title'] = $imdb_info['orig_title'] = $imdb_info['year'] = $imdb_info['rating'] = $imdb_info['votes'] = $imdb_info['gen'] = $imdb_info['runtime'] = $imdb_info['country'] = $imdb_info['lanuage'] = $imdb_info['director'] = $imdb_info['produce'] = $imdb_info['write'] = $imdb_info['compose'] = $imdb_info['plotoutline'] = $imdb_info['plot'] = $imdb_info['trailers'] = $imdb_info['comment'] = ""; require_once IMDB_DIR . 'imdb.class.php'; $rurl = trim($imdburl); $thenumbers = ltrim(strrchr($rurl, 'tt'), 'tt'); $thenumbers = $thenumbers[strlen($thenumbers) - 1] == "/" ? substr($thenumbers, 0, strlen($thenumbers) - 1) : $thenumbers; $thenumbers = preg_replace("[^A-Za-z0-9]", "", $thenumbers); if (($imdb_info = $mc1->get_value('imdb_info_' . $thenumbers)) === false) { $movie = new imdb($thenumbers); $movieid = $thenumbers; $movie->setid($movieid); $cast = $movie->cast(); $imdb_info['id'] = $movieid; $imdb_info['title'] = $movie->title(); $imdb_info['orig_title'] = $movie->orig_title(); $imdb_info['year'] = $movie->year(); $mvotes = $movie->votes(); $mvrating = $movie->rating(); if (!empty($mvrating)) { $imdb_info['rating'] = "{$mvrating}"; $imdb_info['votes'] = "{$mvotes}"; } else { $imdb_info['rating'] = "N/A"; } $gen = $movie->genres(); if (!empty($gen)) { //Changed count($gen) for 4 to limit to only two genres to help keep it tidy on site for ($i = 0; $i + 1 < count($gen); $i++) { $imdb_info['gen'] .= "{$gen[$i]}, "; } $imdb_info['gen'] .= "{$gen[$i]}"; } else { $imdb_info['gen'] = "None Found"; } $runtime = $movie->runtime(); if (!empty($runtime)) { $imdb_info['runtime'] = "{$runtime}"; } else { $imdb_info['runtime'] = "N/A"; } $country = $movie->country(); if (!empty($country)) { for ($i = 0; $i + 1 < count($country); $i++) { $imdb_info['country'] .= "{$country[$i]}, "; } $imdb_info['country'] .= "{$country[$i]}"; } else { $imdb_info['country'] = "None Available"; } $mvlang = $movie->language(); if (!empty($mvlang)) { $imdb_info['lanuage'] = "{$mvlang}"; } else { $imdb_info['lanuage'] = "None Available"; } $director = $movie->director(); if (!empty($director)) { for ($i = 0; $i < count($director); $i++) { $imdb_info['director'] .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "" . $director[$i]["imdb"] . "" . "\">" . "" . $director[$i]["name"] . "" . "</a>, "; } $imdb_info['director'] .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "" . $director[$i]["imdb"] . "" . "\">" . "" . $director[$i]["name"] . "" . "</a> "; } else { $imdb_info['director'] = "None Available"; } $produce = $movie->producer(); if (!empty($produce)) { for ($i = 0; $i < count($produce); $i++) { $imdb_info['produce'] .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "" . $produce[$i]["imdb"] . "" . " \">" . "" . $produce[$i]["name"] . "" . "</a>,"; } $imdb_info['produce'] .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "" . $produce[$i]["imdb"] . "" . " \">" . "" . $produce[$i]["name"] . "" . "</a>"; } else { $imdb_info['produce'] = "None Available"; } $write = $movie->writing(); if (!empty($write)) { for ($i = 0; $i < count($write); $i++) { $imdb_info['write'] .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "" . $write[$i]["imdb"] . "" . "\">" . "" . $write[$i]["name"] . "" . "</a>, "; } $imdb_info['write'] .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "" . $write[$i]["imdb"] . "" . "\">" . "" . $write[$i]["name"] . "" . "</a> "; } $compose = $movie->composer(); if (!empty($compose)) { for ($i = 0; $i < count($compose); $i++) { $imdb_info['compose'] .= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "" . $compose[$i]["imdb"] . "" . " \">" . "" . $compose[$i]["name"] . "" . "</a>, "; } } else { $imdb_info['compose'] .= "N/A"; } $plotoutline = $movie->plotoutline(); if (!empty($plotoutline)) { $imdb_info['plotoutline'] = "" . str_replace(array('<p>', '</p>', '<a href="plotsummary">See full summary</a>'), array("", ""), "{$plotoutline}") . ""; } else { $imdb_info['plotoutline'] .= "No Summary Available"; } $plot = $movie->plot(); if (!empty($plot)) { for ($i = 0; $i < count($plot); $i++) { $imdb_info['plot'] .= str_replace(array("&", "<p>", "</p>"), array("&", "", ""), "{$plot[$i]}<br /><br />"); } } else { $imdb_info['plot'] .= "No Plot Available"; } $trailers = $movie->trailers(); if (!empty($trailers)) { for ($i = 0; $i < count($trailers); $i++) { $imdb_info['trailers'] .= "<a href='" . $trailers[$i] . "' title='Trailer' target='_blank'>IMDB Trailer</a><br />"; } $imdb_info['trailers'] .= "<a href='" . $trailers[$i] . "' title='Trailer' target='_blank'>IMDB Trailer</a>"; } else { $imdb_info['trailers'] = "None Available"; } $comment = $movie->comment(); if (!empty($comment)) { $imdb_info['comment'] = "" . str_replace(array("<p>", "</p>", "<br>", "<a></a>"), array("<br />", "<br />", "<br />", ""), "{$comment}") . ""; } else { $imdb_info['comment'] = "No comments available"; } if (($photo_url = $movie->photo_localurl()) != false) { $imdb_info['poster'] = $photo_url; } $mc1->cache_value('imdb_info_' . $thenumbers, $imdb_info, 0); } return $imdb_info; }