예제 #1
0
파일: metabox.php 프로젝트: qhuit/dcosta
 public function getMyDmVideoMetaboxTabVideos()
 {
     $pn = isset($_POST['pagenumber']) ? $_POST['pagenumber'] : 1;
     $searchTitle = isset($_POST['title']) && $_POST['title'] != 'notitle' ? $_POST['title'] : '';
     $itemsPerPage = 5;
     $dailymotion = new DailymotionOwnMethod();
     $dmvideos = $dailymotion->getDailymotionVideoListForSideVideos('me', $fields = array('id', 'title', 'embed_url', 'thumbnail_url', 'description', 'views_total', 'tags', 'channel.name', 'created_time', 'duration', 'owner.screenname'), (int) $pn, $itemsPerPage, $searchTitle);
     header('Content-type: application/json');
     print json_encode($dmvideos);
     exit;
 }
예제 #2
0
 /**
  * Method to update dailymotion video
  */
 public function updateDailyMotionRecords()
 {
     if (isset($_POST['id']) && !empty($_POST['id']) && is_array($_POST['data'])) {
         $dailymotion = new DailymotionOwnMethod();
         $videoInfo = $dailymotion->updateDailymotionVideoData($_POST['id'], array_filter($_POST['data']));
         session_start();
         if (!isset($_SESSION['dm_success']) || $_SESSION['dm_success'] == "") {
             $_SESSION['dm_success'] = 'Your video was saved successfully.';
         }
         print json_encode(array('msg' => 'Successfully updated'));
         exit;
     }
 }
예제 #3
0
 /**
  * Options page callback
  */
 public function cloudAndDmUploadAction()
 {
     $video_id = $_POST["video_id"];
     check_ajax_referer($video_id . 'pluploadan');
     switch ($_POST['account_name']) {
         case 'cloud':
             $status = wp_handle_upload($_FILES[$video_id . 'async-upload'], array('test_form' => false, 'action' => 'plupload_action'));
             if (!isset($status['error']) && isset($status['file'])) {
                 $info = pathinfo($status['file']);
                 $filesize = filesize($status['file']);
                 try {
                     $obj_dailymotioncloud = new DailymotionCloudOwnMethod($this->usname, $this->appsecret);
                     $media_id = $obj_dailymotioncloud->uploadDailymotionCloudVideo($status['file'], $info['filename']);
                     unlink($status['file']);
                     print str_replace(",", "_", $info['filename']) . '|+|' . $media_id->id . '|+|' . $status['url'] . '|+|' . $this->fileSizeConvert($filesize) . '|+|' . $_POST['account_name'];
                     exit;
                 } catch (Exception $e) {
                     $filename = $info['filename'];
                     unlink($status['file']);
                     error_log($e->getMessage(), 0);
                     error_log($e->getMessage(), 1, "*****@*****.**");
                     die("error|+|{$filename}|+|Failed to transfer on dailymotion cloud");
                 }
             } else {
                 $filename = $info['filename'];
                 die("error|+|{$filename}|+|Failed to open input stream");
                 exit;
             }
             break;
         case 'dailymotion':
             $status = wp_handle_upload($_FILES[$video_id . 'async-upload'], array('test_form' => false, 'action' => 'plupload_action'));
             if (!isset($status['error']) && isset($status['file'])) {
                 $info = pathinfo($status['file']);
                 $filesize = filesize($status['file']);
                 try {
                     $obj_dailymotion = new DailymotionOwnMethod();
                     $media_id = (object) $obj_dailymotion->uploadVideoOnDailymotion($status['file'], $info['filename'], $this->chennelname);
                     unlink($status['file']);
                     print str_replace(",", "_", $info['filename']) . '|+|' . $media_id->id . '|+|' . $status['url'] . '|+|' . $this->fileSizeConvert($filesize) . '|+|' . $_POST['account_name'];
                     exit;
                 } catch (Exception $e) {
                     $filename = $info['filename'];
                     unlink($status['file']);
                     error_log($e->getMessage(), 0);
                     error_log($e->getMessage(), 1, "*****@*****.**");
                     die("error|+|{$filename}|+|Failed to transfer on dailymotion");
                 }
             } else {
                 $filename = $info['filename'];
                 die("error|+|{$filename}|+|Failed to open input stream");
                 exit;
             }
             break;
         default:
             break;
     }
 }
예제 #4
0
 /** 
  * 
  */
 public function conectionDailymotion()
 {
     $DailymotionOwnMethod = new DailymotionOwnMethod();
     try {
         $conecctionresult = $DailymotionOwnMethod->getDailymotionConnectedInformation();
         return $conecctionresult;
     } catch (DailymotionAuthRequiredException $e) {
         return $DailymotionOwnMethod->getDMAuthorizationUrl('popup');
     } catch (DailymotionAuthRefusedException $e) {
         print $e->getMessage();
         die;
     } catch (DailymotionApiException $e) {
         print $e->getMessage();
         die;
     } catch (DailymotionTransportException $e) {
         print $e->getMessage();
         die;
     }
 }