Beispiel #1
0
 public function getLinks($my_id = NULL, $addView = NULL, $my_type = NULL, $debug = NULL)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "getLinks");
     //----------------------------------------------------------
     if (is_null($my_id)) {
         $chk['bool'] = false;
         $chk['message'] = "my_id is NULL.";
         return $chk;
     }
     //----------------------------------------------------------
     $video = $this->getVideo($my_id);
     //----------------------------------------------------------
     if ($video['error']) {
         return $video;
     }
     //----------------------------------------------------------
     if ($addView && $video['bool']) {
         $chk = $this->addView($video['result'][0]);
         if (!$chk['bool']) {
             return $chk;
         }
     }
     //----------------------------------------------------------
     $youtube = new YouTube();
     $chk = $youtube->getLinks($video['bool'] ? $video['result'][0]['youtube_hash'] : $my_id, $my_type, $debug);
     //----------------------------------------------------------
     if ($video['bool'] && !$chk['bool']) {
         $video['result'] = $video['result'][0];
         $video['result']['formats'] = $chk['result']['formats'];
         return $chk = $video;
     } else {
         if (!$chk['bool']) {
             return $chk;
         }
     }
     //----------------------------------------------------------
     if (!$video['bool']) {
         $chk['result']['title'] = stripslashes($youtube->my_title);
     }
     //----------------------------------------------------------
     if ($video['bool']) {
         $video['result'] = $video['result'][0];
         $video['result']['formats'] = $chk['result']['formats'];
         //$video['result']['img_url'] = $chk['result']['img_url'];
         $chk = $video;
     }
     return $chk;
 }