/** * returns the video player code, if the input is URL * * @param int $width width of video player * @param int $height height of video playe * @param int $autoPlay autocomplete option * @return HTML player code */ public function getFeed($width = 640, $height = 385, $autoPlay = 0) { $get_url_feed = new IzapVideos(); $feed = $get_url_feed->input($this->input_object, 'url'); $get_url_feed->videosrc = $feed->videoSrc; $get_url_feed->converted = 'yes'; $player = $get_url_feed->getPlayer($width, $height, $autoPlay); return $player; }
/** * returns the video player code, if the input is URL * * @param int $width width of video player * @param int $height height of video playe * @param int $autoPlay autocomplete option * @return HTML player code */ public function getFeed($width = 600, $height = 360, $autoPlay = 0) { $get_url_feed = new IzapVideos(); $feed = $get_url_feed->input($this->input_object, 'url'); // in case there is an error if (!is_object($feed)) { return elgg_echo('izap_videos:error:code:' . $feed); } $get_url_feed->videotype = $feed->type; $get_url_feed->videosrc = $feed->videoSrc; $get_url_feed->converted = 'yes'; $player = $get_url_feed->getPlayer($width, $height, $autoPlay); return $player; }
$Fail_functions = ini_get('disable_functions'); // $php_version = phpversion(); $exec = !strstr($Fail_functions, 'exec') && is_callable('exec') ? true : false; $curl = extension_loaded('curl') ? true : false; $ffmpeg_path = current(explode(' ', izapAdminSettings_izap_videos('izapVideoCommand'))); $pdo_sqlite = extension_loaded('pdo_sqlite') ? true : false; if ($exec) { $php_command = exec(izapAdminSettings_izap_videos('izapPhpInterpreter') . ' --version', $output_PHP, $return_value); if ($return_value === 0) { $php = nl2br(implode('', $output_PHP)); } $ffmpeg_command = exec($ffmpeg_path . ' -version', $output_FFmpeg, $return_var); if ($return_var === 0) { $ffmpeg = nl2br(implode($output_FFmpeg)); $in_video = elgg_get_plugins_path() . 'izap_videos/server_test/test_video.avi'; $izap_videos = new IzapVideos(); $izap_videos->owner_guid = elgg_get_logged_in_user_guid(); $izap_videos->setFilename('izap_videos/server_test/test_video.avi'); $izap_videos->open('write'); $izap_videos->write(file_get_contents($in_video)); $in_video = $izap_videos->getFilenameOnFilestore(); if (!file_exists($in_video)) { $in_video = elgg_get_plugins_path() . 'izap_videos/server_test/test_video.avi'; exit; $izap_videos->open('write'); $izap_videos->write(file_get_contents($in_video)); $in_video = $izap_videos->getFilenameOnFilestore(); } $izap_videos->close(); if (file_exists($in_video)) { $in_video;
<?php /** * iZAP izap_videos * * @package Elgg videotizer, by iZAP Web Solutions. * @license GNU Public License version 3 * @Contact iZAP Team "<*****@*****.**>" * @Founder Tarun Jangra "<*****@*****.**>" * @link http://www.izap.in/ * */ $videoId = get_input('videoId'); $video = izapVideoCheck_izap_videos($videoId); $attribs = $video->getAttributes(); $newVideo = new IzapVideos(); foreach ($attribs as $attribute => $value) { $newVideo->{$attribute} = $value; } $newVideo->views = 1; $newVideo->owner_guid = get_loggedin_userid(); $newVideo->container_guid = get_loggedin_userid(); $newVideo->access_id = $video->access_id; $newVideo->copiedFrom = $video->owner_guid; $newVideo->copiedVideoId = $videoId; $newVideo->copiedVideoUrl = $video->getUrl(); izapCopyFiles_izap_videos($video->owner_guid, $video->imagesrc); if ($video->videotype == 'uploaded') { izapCopyFiles_izap_videos($video->owner_guid, $video->videofile); izapCopyFiles_izap_videos($video->owner_guid, $video->orignalfile); }
/** * this fucntion actually converts the video * @param string $file file loacation * @param int $videoId video guid * @param int $ownerGuid video owner guid * @param int $accessId access id * @return boolean */ function izapConvertVideo_izap_videos($file, $videoId, $videoTitle, $videoUrl, $ownerGuid, $accessId = 2) { global $CONFIG; $return = FALSE; // works only if we have the input file if (file_exists($file)) { // now convert video // // Need to set flag for the file going in the conversion. $queue_object = new izapQueue(); $queue_object->change_conversion_flag($videoId); $video = new izapConvert($file); $videofile = $video->izap_video_convert(); // check if every this is ok if (!is_array($videofile)) { // if every thing is ok then get back values to save $file_values = $video->getValues(); $izap_videofile = 'izap_videos/uploaded/' . $file_values['filename']; $izap_origfile = 'izap_videos/uploaded/' . $file_values['origname']; $izap_videos = new IzapVideos($videoId); $izap_videos->setFilename($izap_videofile); $izap_videos->open("write"); $izap_videos->write($file_values['filecontent']); //check if you do not want to keep original file if (get_plugin_setting('izapKeepOriginal', GLOBAL_IZAP_VIDEOS_PLUGIN) == 'YES') { $izap_videos->setFilename($izap_origfile); $izap_videos->open("write"); $izap_videos->write($file_values['origcontent']); } $izap_videos->converted = 'yes'; $izap_videos->videofile = $izap_videofile; $izap_videos->orignalfile = $izap_origfile; notify_user($ownerGuid, $CONFIG->site_guid, elgg_echo('izap_videos:notifySub:videoConverted'), sprintf(elgg_echo('izap_videos:notifyMsg:videoConverted'), $izap_videos->getUrl())); return true; } else { $errorReason = $videofile['message']; } } else { $errorReason = elgg_echo('izap_videos:fileNotFound'); } $adminGuid = izapGetSiteAdmin_izap_videos(TRUE); // notify admin notify_user($adminGuid, $CONFIG->site_guid, elgg_echo('izap_videos:notifySub:videoNotConverted'), sprintf(elgg_echo('izap_videos:notifyAdminMsg:videoNotConverted'), $errorReason)); if (!empty($errorReason)) { $return = array('error' => TRUE, 'reason' => $errorReason); } return $return; }
/** * Create new video entity * * @return ElggEntity VIDEOS * * @version 5.0 */ public function createVideoEntity() { if (!filter_var($this->input, FILTER_VALIDATE_URL)) { $this->errors[] = 'Not valid url, currently supported for OFFSERVER videos only'; return FALSE; } // try saving the entity now $izap_videos = new IzapVideos(); $izap_videos->access_id = ACCESS_PUBLIC; $return = $izap_videos->input($this->input, 'url'); if (isset($return->status) && $return->status === FALSE) { $this->errors[] = $return->message; return FALSE; } if ($return->videosrc == '' || $return->filecontent == '') { $this->errors[] = elgg_echo('izap_videos:error'); return FALSE; } $izap_videos->title = $return->title; $izap_videos->description = $return->description; $izap_videos->tags = string_to_tag_array($return->videotags); $izap_videos->videosrc = $return->videosrc; $izap_videos->videotype = $return->type; $izap_videos->orignal_thumb = "izap_videos/" . $return->type . "/orignal_" . $return->filename; $izap_videos->imagesrc = "izap_videos/" . $return->type . "/" . $return->filename; $izap_videos->videotype_site = $return->domain; $izap_videos->converted = 'yes'; $izap_videos->setFilename($izap_videos->orignal_thumb); $izap_videos->open("write"); if ($izap_videos->write($return->filecontent)) { $thumb = get_resized_image_from_existing_file($izap_videos->getFilenameOnFilestore(), 120, 90, true); $izap_videos->setFilename($izap_videos->imagesrc); $izap_videos->open("write"); if (!$izap_videos->write($thumb)) { $this->errors[] = elgg_echo('izap_videos:error:saving_thumb'); return FALSE; } } else { $this->errors[] = elgg_echo('izap_videos:error:saving_thumb'); return FALSE; } // if every thing is good till here now we can save it. if (!$izap_videos->save()) { $this->errors[] = register_error(elgg_echo('izap_videos:error:save')); return FALSE; } return $izap_videos; }
<?php /** * iZAP izap_videos * * @package Elgg videotizer, by iZAP Web Solutions. * @license GNU Public License version 3 * @Contact iZAP Team "<*****@*****.**>" * @Founder Tarun Jangra "<*****@*****.**>" * @link http://www.izap.in/ * */ // get the posted data $postedArray = get_input('izap'); $_SESSION['izapVideos'] = $postedArray; $izap_videos = new IzapVideos($postedArray['guid']); $izap_videos->container_guid = $postedArray['container_guid']; $izap_videos->title = $postedArray['title']; $izap_videos->description = $postedArray['description']; $izap_videos->access_id = $postedArray['access_id']; $izap_videos->tags = string_to_tag_array($postedArray['tags']); $izap_videos->video_views = 1; switch ($postedArray['videoType']) { case 'OFFSERVER': // if url is not valid then send it back if (!filter_var($postedArray['videoUrl'], FILTER_VALIDATE_URL)) { register_error(elgg_echo('izap_videos:error:notValidUrl')); forward($_SERVER['HTTP_REFERER']); } include_once dirname(__FILE__) . '/OFFSERVER.php'; break;