예제 #1
0
        return '';
    }
    if ($cdata) {
        return "    <{$name}><![CDATA[{$content}]]></{$name}>\n";
    }
    return "    <{$name}>{$content}</{$name}>\n";
}
require_once "imdb.class.php";
// Load the API
require_once "imdb_budget.class.php";
$xml = "<?xml version='1.0' encoding='iso-8859-15'?>\n<imdbdata>\n";
// start XML output
foreach ($imdbids as $imdbid) {
    // process each ID
    $movie = new imdb($imdbid);
    $xml .= "  <movie>\n" . "    <imdbid>{$imdbid}</imdbid>\n" . elem('title', $movie->title()) . elem('year', $movie->year()) . elem('rating', $movie->rating()) . elem('votes', $movie->votes()) . elem('tagline', $movie->tagline(), TRUE) . elem('plot', $movie->plotoutline(), TRUE);
    $people = '';
    foreach ($movie->prodCompany() as $person) {
        $people .= ";" . $person['name'];
    }
    if (!empty($people)) {
        $xml .= elem('company', substr($people, 1));
    }
    $people = '';
    foreach ($movie->director() as $person) {
        $people .= ";" . $person['name'];
    }
    if (!empty($people)) {
        $xml .= elem('director', substr($people, 1));
    }
    $people = '';
예제 #2
0
         echo $col[$i] . ', ';
     }
     echo $col[$i] . "</TD></TR>\n";
 }
 flush();
 # Sound
 $sound = $movie->sound();
 if (!empty($sound)) {
     ++$rows;
     echo '<TR><TD><B>Sound:</B></TD><TD>';
     for ($i = 0; $i + 1 < count($sound); $i++) {
         echo $sound[$i] . ', ';
     }
     echo $sound[$i] . "</TD></TR>\n";
 }
 $tagline = $movie->tagline();
 if (!empty($tagline)) {
     ++$rows;
     echo "<TR><TD valign='top'><B>Tagline:</B></TD><TD>{$tagline}</TD></TR>\n";
 }
 #==[ Staff ]==
 # director(s)
 $director = $movie->director();
 if (!empty($director)) {
     ++$rows;
     echo '<TR><TD valign=top><B>Director:</B></TD><TD>';
     echo "<table align='left' border='1' style='border-collapse:collapse;background-color:#ddd;'><tr><th style='background-color:#07f;'>Name</th><th style='background-color:#07f;'>Role</th></tr>";
     for ($i = 0; $i < count($director); $i++) {
         echo '<tr><td width=200>';
         echo '<a href="person.php?mid=' . $director[$i]["imdb"] . '">';
         echo $director[$i]["name"] . '</a></td><td>';
예제 #3
0
 $autodata .= "<strong><font color=\"DarkRed\">" . $lang_details['text_votes'] . "</font></strong>" . "" . $movie->votes() . "<br />\n";
 $autodata .= "<strong><font color=\"DarkRed\">" . $lang_details['text_rating'] . "</font></strong>" . "" . $movie->rating() . "<br />\n";
 $autodata .= "<strong><font color=\"DarkRed\">" . $lang_details['text_language'] . "</font></strong>" . "" . $movie->language() . "<br />\n";
 $autodata .= "<strong><font color=\"DarkRed\">" . $lang_details['text_country'] . "</font></strong>";
 $temp = "";
 for ($i = 0; $i < count($country); $i++) {
     $temp .= "{$country[$i]}, ";
 }
 $autodata .= rtrim(trim($temp), ",");
 $autodata .= "<br />\n<strong><font color=\"DarkRed\">" . $lang_details['text_all_genres'] . "</font></strong>";
 $temp = "";
 for ($i = 0; $i < count($gen); $i++) {
     $temp .= "{$gen[$i]}, ";
 }
 $autodata .= rtrim(trim($temp), ",");
 $autodata .= "<br />\n<strong><font color=\"DarkRed\">" . $lang_details['text_tagline'] . "</font></strong>" . "" . $movie->tagline() . "<br />\n";
 if ($director) {
     $autodata .= "<strong><font color=\"DarkRed\">" . $lang_details['text_director'] . "</font></strong>";
     $temp = "";
     for ($i = 0; $i < count($director); $i++) {
         $temp .= "<a target=\"_blank\" href=\"http://www.imdb.com/Name?" . "" . $director[$i]["imdb"] . "" . "\">" . $director[$i]["name"] . "</a>, ";
     }
     $autodata .= rtrim(trim($temp), ",");
 } elseif ($creator) {
     $autodata .= "<strong><font color=\"DarkRed\">" . $lang_details['text_creator'] . "</font></strong>" . $creator;
 }
 $autodata .= "<br />\n<strong><font color=\"DarkRed\">" . $lang_details['text_written_by'] . "</font></strong>";
 $temp = "";
 for ($i = 0; $i < count($write); $i++) {
     $temp .= "<a target=\"_blank\" href=\"http://www.imdb.com/Name?" . "" . $write[$i]["imdb"] . "" . "\">" . "" . $write[$i]["name"] . "" . "</a>, ";
 }
예제 #4
0
function getimdb($imdb_id, $cache_stamp, $mode = 'minor')
{
    global $lang_functions;
    global $showextinfo;
    $thenumbers = $imdb_id;
    $movie = new imdb($thenumbers);
    $movieid = $thenumbers;
    $movie->setid($movieid);
    $target = array('Title', 'Credits', 'Plot');
    switch ($movie->cachestate($target)) {
        case "0":
            return false;
            break;
        case "1":
            $title = $movie->title();
            $year = $movie->year();
            $country = $movie->country();
            $countries = "";
            $temp = "";
            for ($i = 0; $i < count($country); $i++) {
                $temp .= "{$country[$i]}, ";
            }
            $countries = rtrim(trim($temp), ",");
            $director = $movie->director();
            $director_or_creator = "";
            if ($director) {
                $temp = "";
                for ($i = 0; $i < count($director); $i++) {
                    $temp .= $director[$i]["name"] . ", ";
                }
                $director_or_creator = "<strong><font color=\"DarkRed\">" . $lang_functions['text_director'] . ": </font></strong>" . rtrim(trim($temp), ",");
            } else {
                //for tv series
                $creator = $movie->creator();
                $director_or_creator = "<strong><font color=\"DarkRed\">" . $lang_functions['text_creator'] . ": </font></strong>" . $creator;
            }
            $cast = $movie->cast();
            $temp = "";
            for ($i = 0; $i < count($cast); $i++) {
                if ($i > 2) {
                    break;
                }
                $temp .= $cast[$i]["name"] . ", ";
            }
            $casts = rtrim(trim($temp), ",");
            $gen = $movie->genres();
            $genres = $gen[0] . (count($gen) > 1 ? ", " . $gen[1] : "");
            //get first two genres;
            $rating = $movie->rating();
            $votes = $movie->votes();
            if ($votes) {
                $imdbrating = "<b>" . $rating . "</b>/10 (" . $votes . $lang_functions['text_votes'] . ")";
            } else {
                $imdbrating = $lang_functions['text_awaiting_five_votes'];
            }
            $tagline = $movie->tagline();
            switch ($mode) {
                case 'minor':
                    $autodata = "<font class=\"big\"><b>" . $title . "</b></font> (" . $year . ") <br /><strong><font color=\"DarkRed\">" . $lang_functions['text_imdb'] . ": </font></strong>" . $imdbrating . " <strong><font color=\"DarkRed\">" . $lang_functions['text_country'] . ": </font></strong>" . $countries . " <strong><font color=\"DarkRed\">" . $lang_functions['text_genres'] . ": </font></strong>" . $genres . "<br />" . $director_or_creator . "<strong><font color=\"DarkRed\"> " . $lang_functions['text_starring'] . ": </font></strong>" . $casts . "<br /><p><strong>" . $tagline . "</strong></p>";
                    break;
                case 'median':
                    if (($photo_url = $movie->photo_localurl()) != FALSE) {
                        $smallth = "<img src=\"" . $photo_url . "\" width=\"105\" alt=\"poster\" />";
                    } else {
                        $smallth = "";
                    }
                    $runtime = $movie->runtime();
                    $language = $movie->language();
                    $plot = $movie->plot();
                    $plots = "";
                    if (count($plot) != 0) {
                        //get plots from plot page
                        $plots .= "<font color=\"DarkRed\">*</font> " . strip_tags($plot[0], '<br /><i>');
                        $plots = mb_substr($plots, 0, 300, "UTF-8") . (mb_strlen($plots, "UTF-8") > 300 ? " ..." : "");
                        $plots .= strpos($plots, "<i>") == true && strpos($plots, "</i>") == false ? "</i>" : "";
                        //sometimes <i> is open and not ended because of mb_substr;
                        $plots = "<font class=\"small\">" . $plots . "</font>";
                    } elseif ($plotoutline = $movie->plotoutline()) {
                        //get plot from title page
                        $plots .= "<font color=\"DarkRed\">*</font> " . strip_tags($plotoutline, '<br /><i>');
                        $plots = mb_substr($plots, 0, 300, "UTF-8") . (mb_strlen($plots, "UTF-8") > 300 ? " ..." : "");
                        $plots .= strpos($plots, "<i>") == true && strpos($plots, "</i>") == false ? "</i>" : "";
                        //sometimes <i> is open and not ended because of mb_substr;
                        $plots = "<font class=\"small\">" . $plots . "</font>";
                    }
                    $autodata = "<table style=\"background-color: transparent;\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n" . ($smallth ? "<td class=\"clear\" valign=\"top\" align=\"right\">\n{$smallth}\n</td>" : "") . "<td class=\"clear\" valign=\"top\" align=\"left\">\n<table style=\"background-color: transparent;\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"350\">\n<tr><td class=\"clear\" colspan=\"2\"><img class=\"imdb\" src=\"pic/trans.gif\" alt=\"imdb\" /> <font class=\"big\"><b>" . $title . "</b></font> (" . $year . ") </td></tr>\n<tr><td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_imdb'] . ": </font></strong>" . $imdbrating . "</td>\n" . ($runtime ? "<td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_runtime'] . ": </font></strong>" . $runtime . $lang_functions['text_min'] . "</td>" : "<td class=\"clear\"></td>") . "</tr>\n<tr><td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_country'] . ": </font></strong>" . $countries . "</td>\n" . ($language ? "<td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_language'] . ": </font></strong>" . $language . "</td>" : "<td class=\"clear\"></td>") . "</tr>\n<tr><td class=\"clear\">" . $director_or_creator . "</td>\n<td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_genres'] . ": </font></strong>" . $genres . "</td></tr>\n<tr><td class=\"clear\" colspan=\"2\"><strong><font color=\"DarkRed\">" . $lang_functions['text_starring'] . ": </font></strong>" . $casts . "</td></tr>\n" . ($plots ? "<tr><td class=\"clear\" colspan=\"2\">" . $plots . "</td></tr>" : "") . "\n</table>\n</td>\n</table>";
                    break;
            }
            return $autodata;
        case "2":
            return false;
            break;
        case "3":
            return false;
            break;
    }
}
예제 #5
0
 $autodata .= "<br />\n<strong><font color=\"red\"> Year: </font></strong>" . "" . $movie->year() . "<br />\n";
 $autodata .= "<strong><font color=\"red\"> Runtime: </font></strong>" . "" . $movie->runtime() . "" . " mins<br />\n";
 $autodata .= "<strong><font color=\"red\"> Votes: </font></strong>" . "" . $movie->votes() . "<br />\n";
 $autodata .= "<strong><font color=\"red\"> Rating: </font></strong>" . "" . $movie->rating() . "<br />\n";
 $autodata .= "<strong><font color=\"red\"> Language: </font></strong>" . "" . $movie->language() . "<br />\n";
 $autodata .= "<strong><font color=\"red\"> Country: </font></strong>";
 for ($i = 0; $i + 1 < count($country); $i++) {
     $autodata .= "{$country[$i]}, ";
 }
 $autodata .= "{$country[$i]}";
 $autodata .= "<br />\n<strong><font color=\"red\"> All Genres: </font></strong>";
 for ($i = 0; $i + 1 < count($gen); $i++) {
     $autodata .= "{$gen[$i]}, ";
 }
 $autodata .= "{$gen[$i]}";
 $autodata .= "<br />\n<strong><font color=\"red\"> Tagline: </font></strong>" . "" . $movie->tagline() . "<br />\n";
 $autodata .= "<strong><font color=\"red\"> Director: </font></strong>";
 for ($i = 0; $i < count($director); $i++) {
     $autodata .= "<a target=\"_blank\" href=\"http://us.imdb.com/Name?" . "" . $director[$i]["imdb"] . "" . "\">" . "" . $director[$i]["name"] . "" . "</a> ";
 }
 $autodata .= "<br />\n<strong><font color=\"red\"> Writing By: </font></strong>";
 for ($i = 0; $i < count($write); $i++) {
     $autodata .= "<a target=\"_blank\" href=\"http://us.imdb.com/Name?" . "" . $write[$i]["imdb"] . "" . "\">" . "" . $write[$i]["name"] . "" . "</a> ";
 }
 $autodata .= "<br />\n<strong><font color=\"red\"> Produced By: </font></strong>";
 for ($i = 0; $i < count($produce); $i++) {
     $autodata .= "<a target=\"_blank\" href=\"http://us.imdb.com/Name?" . "" . $produce[$i]["imdb"] . "" . " \">" . "" . $produce[$i]["name"] . "" . "</a> ";
 }
 $autodata .= "<br />\n<strong><font color=\"red\"> Music: </font></strong>";
 for ($i = 0; $i < count($compose); $i++) {
     $autodata .= "<a target=\"_blank\" href=\"http://us.imdb.com/Name?" . "" . $compose[$i]["imdb"] . "" . " \">" . "" . $compose[$i]["name"] . "" . "</a> ";