Skip to content

Commit

Permalink
v6.0.3 - see CHANGELOG.
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianBeiner committed Jan 8, 2016
1 parent df4b62a commit 7955217
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.

## [6.0.3] - 2016-01-08
### Changed
- Fixed `getPoster`. It most likely always did a hot link to IMDB instead of the local image. The default is now to hot link to IMDb with the small resolution.
- Made the private `$iId` variable public. You can now access the ID of the movie without any problems (eg. `$oIMDB->iId`).
- Reformatted `imdb.example.php` and also fixed a small issue there.

## [6.0.2] - 2015-12-19
### Changed
- Added more test cases to `imdb.example.php`.
Expand Down Expand Up @@ -36,3 +42,4 @@ All notable changes to this project will be documented in this file.
[6.0.0]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/5.5.21...v6.0.0
[6.0.1]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.0...v6.0.1
[6.0.2]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.1...v6.0.2
[6.0.3]: https://github.com/FabianBeiner/PHP-IMDB-Grabber/compare/v6.0.2...v6.0.3
44 changes: 20 additions & 24 deletions examples/imdb.example.php
Expand Up @@ -7,24 +7,24 @@
<style>
body {
background-color: #E5E5E5;
color: #222;
font-family: "Open Sans", sans-serif;
font-size: 15px;
max-width: 1000px;
margin: 20px auto;
width: 100%;
color: #222;
font-family: "Open Sans", sans-serif;
font-size: 15px;
max-width: 1000px;
margin: 20px auto;
width: 100%;
}

p {
margin: 0 0 10px;
margin: 0 0 10px;
padding: 0;
}

hr {
clear: both;
margin: 25px 0;
border: 1px #000 solid;
height: 1px;
clear: both;
margin: 25px 0;
border: 1px #000 solid;
height: 1px;
background: #FFF;
}

Expand All @@ -34,12 +34,12 @@

a:hover, a:focus, a:active {
text-decoration: none;
color: #222;
color: #222;
}

h1 {
font-size: 32px;
text-align: center;
font-size: 32px;
text-align: center;
font-weight: 700;
}
</style>
Expand All @@ -51,8 +51,7 @@
$oIMDB = new IMDB('http://us.imdb.com/Title?0144117');
if ($oIMDB->isReady) {
echo '<p><a href="' . $oIMDB->getUrl() . '">' . $oIMDB->getTitle() . '</a> got rated ' . $oIMDB->getRating() . '.</p>';
}
else {
} else {
echo '<p>Movie not found!</p>';
}
?>
Expand All @@ -64,12 +63,11 @@
if ($oIMDB->isReady) {
echo '<h1>' . $oIMDB->getTitle() . '</h1>';
foreach ($oIMDB->getAll() as $aItem) {
if ($oIMDB->sNotFound !== $aItem['value']) {
if ($oIMDB::$sNotFound !== $aItem['value']) {
echo '<p><b>' . $aItem['name'] . '</b>: ' . $aItem['value'] . '</p>';
}
}
}
else {
} else {
echo '<p>Movie not found!</p>';
}
?>
Expand All @@ -80,9 +78,8 @@
$oIMDB = new IMDB('http://www.imdb.com/title/tt1022603/');
if ($oIMDB->isReady) {
echo '<p><a href="' . $oIMDB->getUrl() . '">' . $oIMDB->getTitle() . '</a> got rated ' . $oIMDB->getRating() . '.</p>';
echo '<p><img src="' . $oIMDB->getPoster() . '" style="float:left;margin:4px 10px 10px 0;"> <b>About the movie:</b> ' . $oIMDB->getPlot() . '</p>';
}
else {
echo '<p><img src="../' . $oIMDB->getPoster('small', true) . '" style="float:left;margin:4px 10px 10px 0;"> <b>About the movie:</b> ' . $oIMDB->getPlot() . '</p>';
} else {
echo '<p>Movie not found!</p>';
}
?>
Expand All @@ -93,8 +90,7 @@
$oIMDB = new IMDB('Fabian Beiner never made a movie. Yet!');
if ($oIMDB->isReady) {
echo '<p><b>' . $oIMDB->getTitle() . '</b></p>';
}
else {
} else {
echo '<p>Movie not found!</p>';
}
?>
Expand Down
8 changes: 4 additions & 4 deletions imdb.class.php
Expand Up @@ -14,7 +14,7 @@
* @author Fabian Beiner <fb@fabianbeiner.de>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/FabianBeiner/PHP-IMDB-Grabber GitHub Repository
* @version 6.0.2
* @version 6.0.3
*/
class IMDB
{
Expand Down Expand Up @@ -51,7 +51,7 @@ class IMDB
/**
* @var null|int The ID of the movie.
*/
private $iId = null;
public $iId = null;

/**
* @var string What to search for?
Expand Down Expand Up @@ -810,7 +810,7 @@ public function getPlot($iLimit = 0) {
*
* @return bool|string Path to the poster.
*/
public function getPoster($sSize = 'small', $bDownload = true) {
public function getPoster($sSize = 'small', $bDownload = false) {
if (true === $this->isReady) {
$sMatch = IMDBHelper::matchRegex($this->sSource, self::IMDB_POSTER, 1);
if (false !== $sMatch) {
Expand All @@ -821,7 +821,7 @@ public function getPoster($sSize = 'small', $bDownload = true) {
return IMDBHelper::cleanString($sMatch);
} else {
$sLocal = IMDBHelper::saveImage($sMatch, $this->iId);
if (file_exists($sLocal)) {
if (file_exists(dirname(__FILE__) . '/' . $sLocal)) {
return $sLocal;
} else {
return $sMatch;
Expand Down

0 comments on commit 7955217

Please sign in to comment.