public static function getAnimeList($series, $is_admin = false) { $id = 0; if (Sentry::check()) { $id = Sentry::getUser()->id; } foreach ($series as $serie) { echo '<li class="item'; if (UserLibrary::getFavorite($serie->id, $id)) { echo ' favorite'; } if ($serie->status == 1) { echo ' ongoing'; } if ($serie->type == 2) { echo ' movie'; } echo '"><a href="' . URL::to('anime/' . $serie->id . '/' . str_replace(array(" ", "/", "?"), "_", $serie->name)) . '">'; $synonyms = Anime::getSynonyms($serie); if (!empty($synonyms)) { echo '<span data-toggle="tooltip-right" title="' . $synonyms . '">' . $serie->name . '</span>'; } else { echo '<span>' . $serie->name . '</span>'; } echo '<div class="pull-right" style="margin-top: -3px;">'; if ($serie->status == 1) { echo '<span class="tag-red">ongoing</span>'; } else { if ($serie->type == 2) { echo '<span class="tag-blue">movie</span>'; } } if ($is_admin) { echo '<button style="margin-left: 5px;" id="update_mirrors_button" class="btn-small btn-success"><input type="hidden" name="anime_id" value="' . $serie->id . '"/><span class="icon-download-alt"></span>' . $serie->id . '</button>'; } echo '</div></a></li>'; } }
public function updateLibrary($user_id, $anime_id, $library_status) { $anime = Anime::findOrFail($anime_id, array("id", "name")); $row = UserLibrary::firstOrNew(array('user_id' => $user_id, 'anime_id' => $anime->id)); $row->library_status = $library_status; $row->save(); return $anime->name; }
function print_anime($series) { if (Sentry::check() && Sentry::getUser()->isSuperUser()) { Anime::getAnimeList($series, true); } else { Anime::getAnimeList($series); } }
public function getEpisode($id, $name, $episode) { $anime = Anime::find($id); if (!empty($anime)) { $mirrors = MasterAnime::getEpisode($anime->id, $episode); if (!empty($mirrors) && count($mirrors) > 0) { return View::make('watch', array('title' => 'Watch ' . $anime->name . ' - episode ' . $episode, 'description' => 'Watch ' . $anime->name . ' episode ' . $episode . ' online in HD on desktop, tablet and mobile.', 'anime' => $anime, 'mirrors' => $mirrors, 'episode' => $episode)); } return App::abort(404); } return App::abort(404); }
public static function updateThumbnails() { $eps = Latest::getLatestRows(null); if (!empty($eps)) { foreach ($eps as $ep) { $anime = Anime::findOrFail($ep->anime_id); $ep->img = Anime::getCover($anime); $ep->save(); } return 'updated thumbnails'; } return 'latest episodes is empty!'; }
public static function addSocialList($anime_id, $episode, $status) { if (Sentry::check()) { $anime = Anime::findOrFail($anime_id); $scrubbler = new AnimeDataScraper(); if (!empty(Sentry::getUser()->mal_password)) { $scrubbler->addMAL(Sentry::getUser(), $anime, $episode, $status); } if (!empty(Sentry::getUser()->hum_auth)) { $scrubbler->addHummingbird(Sentry::getUser(), $anime, $episode, $status); } return true; } return false; }
public function get($episode = 1, $anime_platform = AnimePlatform::all, $endep = -1) { $this->mirrors = array(); $anime = Anime::find($this->anime_id); if (empty($anime)) { return null; } $urls = ScrapeUrl::find($this->anime_id); if (empty($urls)) { return $this->scrape_ar($this->getUrlSuffix($anime->name), $episode, $endep); } else { if ($anime_platform == AnimePlatform::all) { if (empty($urls->suffix_animerush)) { $this->scrape_ar($this->getUrlSuffix($anime->name), $episode, $endep); } else { $this->scrape_ar($urls->suffix_animerush, $episode, $endep); } if (!empty($urls->suffix_rawranime)) { $this->scrape_ra($urls->suffix_rawranime, $episode, $endep); } return $this->mirrors; } else { if ($anime_platform == AnimePlatform::animerush) { if (empty($urls->suffix_animerush)) { return $this->scrape_ar($this->getUrlSuffix($anime->name), $episode, $endep); } return $this->scrape_ar($urls->suffix_animerush, $episode, $endep); } else { if ($anime_platform == AnimePlatform::rawranime) { if (!empty($urls->suffix_rawranime)) { return $this->scrape_ra($urls->suffx_rawranime, $episode, $endep); } return null; } } } } return null; }
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ Route::get('/', function () { return View::make('index'); }); Route::group(['prefix' => 'api'], function () { Route::get('/anime', function () { $data = Anime::get(); return $data; }); Route::get('/anime/{anime}/{episode}', function ($animeslug, $episodeslug) { $anime = Anime::where('slug', $animeslug)->first(); $episode = Episode::where('episodeNum', $episodeslug)->where('anime_id', $anime->id)->first(); return ["episode" => $episode, "anime" => $anime]; }); Route::get('/anime/{slug}', function ($slug) { //$data = Anime::where('slug', $slug)->first(); $data = Anime::with('episodes')->where('slug', $slug)->first(); return $data; }); });
@if (!empty($anime->youtube_trailer_id)) <div class="tab-pane" id="trailer"> <iframe height="290px" width="100%" src="//www.youtube.com/embed/{{ $anime->youtube_trailer_id }}" frameborder="0" allowfullscreen></iframe> </div> @endif </div> </div> </div> <div class="span2 mod_buttons"> <a target="_blank" href="http://myanimelist.net/anime/{{ $anime->mal_id }}" type="button" data-toggle="tooltip" title="view on MyAnimeList" class="met_button border-radius-right border-radius-left">{{ HTML::image('img/mal-logo.png', 'myanimelist logo', array("style" => "margin: -8px 0px;")) }}</a> <a target="_blank" href="http://hummingbird.me/anime/{{ $anime->hum_id }}" type="button" data-toggle="tooltip" title="view on hummingbird" class="met_button border-radius-right border-radius-left">{{ HTML::image('img/hummingbird-logo.png', 'hummingbird logo', array("style" => "margin: -8px 0px;")) }}</a> <a user-library="plan_to_watch" href="#" type="button" data-toggle="tooltip" title="Plan to watch" class="met_button border-radius-right border-radius-left"><i class="icon-plus"></i></a> </div> </div> <?php $screencaps = Anime::getScreencaps($anime); if (!empty($screencaps)) { $screencaps = array_slice($screencaps, 0, 4); } ?> <div class="row-fluid ads"> <div class="span12"> <iframe src="http://g.admedia.com/banner.php?type=graphical-iframe&pid=1738328&size=728x90&page_url=[encoded_page_url]" width="728" height="90" frameborder="0" scrolling="no" allowtransparency="yes"></iframe> </div> </div> @if (!empty($screencaps)) <div class="row-fluid"> <div class="row-fluid"> <div class="span12"> <h1 class="title">Screencaps</h1> </div>
public function updateMirror() { return $this->execute(function () { $anime_id = Input::get('anime_id'); $episode = Input::get('episode'); $src = Input::get('src'); $host = Input::get('host'); $quality = Input::get('quality'); $anime = Anime::findOrFail($anime_id, array('id', 'name')); Mirror::create(["anime_id" => $anime->id, "episode" => $episode, "src" => $src, "host" => $host, "quality" => $quality, "subbed" => 1]); return View::make('mod_panel')->nest('update_msg', 'child.alerts', array('msg_type' => 'success', 'msg' => 'You succesfully added a new mirror for: ' . $anime->name)); }); }
/** * Function viewMirror($permalink, $episode, $mirrorid) * * Get episode anime with the same anime and episode * * Parameters: * @permalink (String) * @episode (int) * @mirrorid (int) */ public function viewMirror($permalink, $episode, $mirrorid) { /** * Get title website from database with the same parameter. * * @title (Object) * */ $title = $this->config_model->select_by_function('SITE_TITLE')->row(); /** * Get data anime from selected @permalink * * Paremeters: * @permalink (String) * * return @anime (Object) */ $info['anime'] = $this->anime_model->select_by_permalink($permalink)->row(); /** * Define @mirror (Array) * @mirror keys: * get, and parentid */ $mirror = array('get' => true, 'parentid' => $mirrorid); /** * Fetch another episode who have the same episode and idanime * * Parameters: * @idanime (int) * @episode (int) * @mirror (int) * return @info[sAnime] (Object) */ $info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode, $mirror)->row(); $info['hashcode'] = "0"; // Define variable @info[hashcode] and store default value with 0 /** * Condition when the mirror link is found within database */ if (!empty($info['sAnime'])) { /** * Condition to check domain is exists in database or not * with status_streaming is equal 1 * If equal then store the data in @info[hashcode] (String) */ if ($this->hosting_model->checkHosting($info['sAnime']->namahosting)->row()->status_streaming == 1) { $info['eAnime'] = $info['sAnime']; $info['hashcode'] = Anime::decodeStream($info['sAnime']->hashcode); } else { show_404(); } } /** * Condition when @info[hashcode] is empty or not set * redirected to new url download anime */ if (empty($info['hashcode'])) { redirect('download/' . $info['anime']->permalink . '/' . $info['sAnime']->episode . '/'); } /** * Fetch another episode who have the same episode and idanime */ $info['mirror'] = $info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode, true)->result(); /** * Define variable @data (array) that need to be used in header * Configuring meta tag header * */ $data['website'] = $title->content; $data['title'] = $info['anime']->title_anime . ' Episode ' . $info['eAnime']->episode . ' | ' . $title->content; $data['description'] = character_limiter($info['anime']->synopsis, 150, '...'); $data['keywords'] = null; /** * Define variable @info (Object) that need to use within template. * */ $info['rating'] = $this->rating->get($info['anime']->idanime); $genre_count = $this->generate_genres->countTags($info['anime']->genres); $info['genre_link'] = $this->generate_genres->get_tag_link($info['anime']->genres, $genre_count); $this->load->view('header', $data); $this->load->view('templates/single-episode', $info); $this->load->view('footer', $data); }
/** * Deletes sagas and chapters will not be any more in database. * Used in /anime/actions/executeRefreshAnime * * @param Anime $anime * @param Array $current_sagas ex: [2, 5] * @param Array $current_chapters ex: [23, 54] */ public static function deleteSagasAndChapters($anime, $current_sagas, $current_chapters) { foreach ($anime['Sagas'] as $saga) { if (!in_array($saga['id'], $current_sagas)) { $anime->unlink('Sagas', $saga['id']); $saga->delete(); } else { foreach ($saga['Chapters'] as $chapter) { if (!in_array($chapter['id'], $current_chapters)) { $saga->unlink('Chapters', $chapter['id']); $chapter->delete(); } } } } }
<?php try { $user = Sentry::findUserById($list->user_id); echo '<span>by ' . $user->username . '</span>'; } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { echo '<span>by Unknown</span>'; } ?> <a class="anime_amount" href="{{ URL::to('/lists/' . $list->id . '/' . str_replace(array(" ", "/", "?"), '_', $list->title)) }}"><i class="icon-th-list icon-white"> {{{ count($anime_ids) }}}</i></a> </div> <p class="description">{{{ $list->description }}}</p> </div> <div class="span6 covers"> @foreach ($first_8 as $anime_id) <?php $anime = Anime::findOrFail($anime_id, array('id', 'name', 'cover', 'mal_image')); ?> <div class="cover"> <a data-toggle="tooltip" title="{{{ $anime->name }}}" href="{{ URL::to('/anime/' . $anime->id . '/' . str_replace(array(" ", "/", "?"), '_', $anime->name)) }}"> <img src="{{ Anime::getCover($anime) }}"> </a> </div> @endforeach </div> </div> @endforeach <div class="row-fluid"> <div class="span12"> {{ $lists->links(); }} </div> </div>
@if (!empty($series) && count($series) > 0) <ul class="last-watched"> @foreach ($series as $watched) <?php $anime = Anime::findOrFail($watched->anime_id, array('id', 'name')); $next = MasterAnime::getNextEpisode($anime->id, $watched->last_watched_episode); ?> <li id="{{$anime->id}}" class="item{{{ $next ? '' : ' finished'}}}"> <p>{{{ $anime->name }}} - ep. {{{ $watched->last_watched_episode}}}</p> <p class="time hidden-phone">seen {{{ Latest::time_elapsed_string($watched->last_watched_time) }}} ago</p> <ul class="nav nav-pills"> <li> <a data-toggle="tooltip" title="index eps" class="met_button" href="{{{ URL::to('/anime/' . $anime->id . '/' . str_replace(array(" ", "/", "?"), '_', $anime->name)) }}}">-</a> </li> @if ($next) <li> <a data-toggle="tooltip" title="next ep" class="met_button" href="{{{ URL::to('/watch/anime/' . $anime->id . '/' . str_replace(array(" ", "/", "?"), '_', $anime->name) . '/' . $next) }}}">></a> </li> @endif <li class="space"> <a id="drop-anime" data-toggle="tooltip" title="drop anime" class="met_button" href="#"><input name="anime_id" type="hidden" value="{{{$anime->id}}}">x</a> </li> </ul> </li> @endforeach </ul> <script type="text/javascript"> $(document).ready(function () { $('li[class=space] a[id=drop-anime]').on('click', function (e) { e.preventDefault()
public function save($data) { $anime = Anime::firstOrNew(array('mal_id' => $data["mal-id"])); $anime->mal_id = $data["mal-id"]; $anime->hum_id = $data["hum-id"]; $anime->name = $data["title"]; if ($data["title"] != $data["english_title"]) { $anime->english_name = $data["english_title"]; } if (!empty($data["synonyms"])) { $synonyms = explode("; ", $data["synonyms"]); $anime->name_synonym_2 = $synonyms[0]; if (count($synonyms) >= 2) { $anime->name_synonym_3 = $synonyms[1]; } } $anime->mal_image = $data["cover"]; $anime->start_date = $data["start_date"]; $anime->end_date = $data["end_date"]; $anime->description = $data["synopsis"]; $anime->mal_total_eps = $data["total_eps"]; $anime->status = AnimeWrapper::getStatusInt($data["status"]); $anime->type = AnimeWrapper::getTypeInt($data["type"]); $anime->genres = $data["genres"]; $anime->screencaps = $data["screencaps"]; $anime->youtube_trailer_id = $data["youtube_trailer_id"]; $anime->save(); }
return View::make('home'); }); Route::get('/donate', function () { return View::make('donate'); }); Route::get('/animehd', function () { return View::make('animehd'); }); Route::get('/sitemap', function () { $sitemap = App::make("sitemap"); $sitemap->add('http://www.masterani.me/', '2014-07-09T20:10:00+02:00', '1.0', 'daily'); $sitemap->add('http://www.masterani.me/latest', '2014-07-09T12:30:00+02:00', '0.9', 'daily'); $sitemap->add('http://www.masterani.me/anime', '2014-07-09T12:30:00+02:00', '0.9', 'daily'); $sitemap->add('http://www.masterani.me/anime/chart', '2014-07-09T12:30:00+02:00', '0.9', 'daily'); $sitemap->add('http://www.masterani.me/animehd', '2014-07-09T12:30:00+02:00', '0.9', 'weekly'); $animes = Anime::all(); foreach ($animes as $anime) { $name = htmlspecialchars($anime->name, ENT_QUOTES, 'UTF-8'); $sitemap->add('http://www.masterani.me/anime/' . $anime->id . '/' . str_replace(array(" ", "/", "?"), '_', $name), $anime->date_updated, '0.9', 'weekly'); } return $sitemap->render(); }); Route::get('/debug', function () { if (Sentry::check()) { $user = Sentry::getUser(); if ($user->isSuperUser()) { RecentAnime::scrape(); return '<br/>DONE SCRAPING'; } return 'must be super user'; }
<div class="row-fluid"> <div class="span12"> <div class="clearfix"> <h3 class="met_title_with_childs pull-left"> PLAN TO WATCH<span class="met_subtitle">ANIME YOU STILL HAVE TO WATCH</span> </h3> </div> <?php $planned = UserLibrary::user(Sentry::getUser()->id)->status(6)->paginate(6); ?> @if(!empty($planned) && count($planned) > 0) <div class="row-fluid"> <div class="span12"> @foreach($planned as $plan) <?php $anime = Anime::findOrFail($plan->anime_id, array('id', 'name', 'mal_image')); ?> {{ View::make('child.card_anime', array("anime_id" => $anime->id, "anime_name" => $anime->name, "anime_episode" => 0, "anime_img" => $anime->mal_image, "display" => "list", "off_lazy" => true)) }} @endforeach </div> {{ $planned->links() }} </div> @else <div class="row-fluid"> <div class="span12"> <p>You haven't added any anime you would like to see!</p> </div> </div> @endif </div> </div>
} $aVideo = "<strong>Video:</strong> "; if ((int) $DataAnime->Resolution >= 720) { $aVideo .= "Hi-def " . $DataAnime->Resolution; } else { $aVideo .= "Normal " . $DataAnime->Resolution; } $aAudio = "<strong>Audio:</strong> " . Anime::Language($DataAnime->Audio); $aSubtitle = "<strong>Subtitle:</strong> " . Anime::Language($DataAnime->Subtitle); $aSeason = Anime::Season($DataAnime->Season) . " " . $DataAnime->Year; if ($DataAnime->Season == 0 && $DataAnime->Year != 0) { $aSeason = $DataAnime->Year; } elseif ($DataAnime->Year == 0) { $aSeason = Anime::Season($DataAnime->Season); } $aSize = "<strong>Size: </strong>" . Anime::Size($DataAnime->Sizes) . " (" . $DataAnime->Items . " Items)"; if (!count($DataAnime->Fansub)) { $aFansub = "None"; } else { $aFansub = implode("<br>", $DataAnime->Fansub); } $ImageName = $DataAnime->Year . "-" . $DataAnime->Season . "-" . trim($DataAnime->Name['en']); if (isset($DataAnime->Episode['en'])) { $ImageName .= "-" . trim($DataAnime->Episode['en']); } $iImage = ereg_replace("[\\.\\-\\![:space:]]", "", strtolower($ImageName)) . ".jpg"; if (!file_exists("C:\\/AppServ\\/www\\/al3e.ru\\/store\\/snapshot\\/" . $iImage)) { $iImage = "!no-image.jpg"; } $iIcon = 0; if ($DataAnime->Drop) {
$interval = $future->diff($today); if ($future > $today) { $date = $interval->format('%d%H'); array_push($anime, array('episode' => $latest->episode, 'interval' => $interval, 'anime' => $serie, 'sort' => $date)); } } } return $anime; } $series = getAnime(); usort($series, function ($a1, $a2) { return $a1["sort"] < $a2["sort"] ? -1 : 1; }); $count = 0; $total_count = 0; $total = count($series); foreach ($series as $serie) { $time = ''; if ($serie["interval"]->d > 0) { $time .= $serie["interval"]->d . 'days '; } $time .= $serie["interval"]->h . 'hrs ' . $serie["interval"]->i . 'mins '; echo View::make('child.card_anime', array("anime_id" => $serie["anime"]->id, "anime_name" => $serie["anime"]->name, "anime_episode" => (int) $serie["episode"] + 1, "anime_img" => Anime::getCover($serie["anime"]), "time" => $time, "display" => "chart")); } ?> </div> </div> </div> </div> </div> @stop