Exemple #1
0
 /**
  * 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);
 }