public function getContent() { if (!is_array($content = Callback::decode($this->log_content))) { throw new Exception('Callback failed!'); } if (count($content) > self::MaxSearchResults) { $content = array_slice($content, 0, self::MaxSearchResults); } return $content; }
public function callback() { if (!$this->id) { throw new Exception('Movie does not exists yet'); } if ($this->callback_at) { throw new Exception('Movie callback already executed'); } $arr_infos = Callback::decode(Callback::getMovieInfo($this->tmdb_id)); $arr_infos = array_shift($arr_infos); $this->addMovieImages(array_merge($arr_infos['posters'], $arr_infos['backdrops'])); unset($arr_infos['posters']); unset($arr_infos['backdrops']); $this->addMovieAttributes($arr_infos); $this->callback_at = time(); $this->save(); $this->getRelated('attributes', true); $this->getRelated('images', true); }
<div id="cast"> <?php if (count($cast = Callback::decode(html_entity_decode($movie->get('cast'))))) { ?> <ul> <?php foreach ($cast as $person) { ?> <?php if ($person['character']) { ?> <?php echo $person['character']; ?> <strong><?php echo $person['name']; ?> </strong> <?php } else { ?> <?php echo $person['job']; ?> <strong><?php echo $person['name']; ?> </strong> <?php } ?>