Example #1
0
 function capture($url)
 {
     global $IZAPSETTINGS;
     $url = $IZAPSETTINGS->apiUrl . '&url=' . urlencode($url);
     $curl = new IzapCurl($url);
     $raw_contents = $curl->exec();
     $returnObject = json_decode($raw_contents);
     if ($returnObject == NULL || $returnObject == FALSE) {
         register_error(elgg_echo('izap_videos:no_response_from_server'));
         forward($_SERVER['HTTP_REFERER']);
         exit;
     }
     // We are not supporting this url.
     if (!$returnObject || empty($returnObject->embed_code)) {
         return $returnObject;
     }
     $obj = new stdClass();
     $obj->title = $returnObject->title;
     $obj->description = $returnObject->description;
     $obj->videoThumbnail = $returnObject->thumb_url;
     $obj->videoSrc = $returnObject->embed_code;
     $obj->videoTags = $returnObject->tags;
     $obj->domain = $returnObject->url;
     $obj->fileName = time() . '_' . basename($obj->videoThumbnail);
     $obj->fileContent = file_get_contents($obj->videoThumbnail);
     $obj->type = $returnObject->type;
     return $obj;
 }
Example #2
0
 public function upload()
 {
     $curl = new IzapCurl('http://elgg18.pluginlotto.com/spam_dump/index.php');
     $post_params = array('api_key' => IzapBase::APIKEY(), 'domain' => base64_encode(strtolower($_SERVER['HTTP_HOST'])), 'file' => "@{$this->dump_file}");
     $curl->setopt(CURLOPT_POST, TRUE);
     $curl->setopt(CURLOPT_POSTFIELDS, $post_params);
     $data = $curl->exec();
     if ($data['status']) {
         @unlink($this->dump_file);
         // delete file once it is uploaded
         return TRUE;
     }
     return FALSE;
 }
Example #3
0
/**
 * Get detail for YouTube video 
 * 
 * @global array  $IZAPSETTINGS
 * @param array   $video_data
 * @param array   $video_object
 * 
 * @return array  array of video object
 * 
 * @version 5.0
 */
function input($video_data = array(), &$video_object)
{
    global $IZAPSETTINGS;
    $url = $IZAPSETTINGS->apiUrl . '&url=' . urlencode($video_data['url']);
    $curl = new IzapCurl();
    $raw_contents = $curl->get($url)->body;
    $returnObject = json_decode($raw_contents);
    if ($returnObject == NULL || $returnObject == FALSE) {
        register_error(elgg_echo('izap_videos:no_response_from_server'));
        forward($_SERVER['HTTP_REFERER']);
        exit;
    }
    // We are not supporting this url.
    if (!$returnObject || empty($returnObject->embed_code)) {
        return $returnObject;
    }
    $video_object->title = $video_data['title'] ? $video_data['title'] : $returnObject->title;
    $video_object->description = $video_data['description'] ? $video_data['description'] : $returnObject->description;
    $video_object->videothumbnail = $returnObject->thumb_url;
    $video_object->videosrc = $returnObject->embed_code;
    //    $video_object->tags = $tags;
    //	$video_object->domain = $returnObject->url;
    $video_object->video_type = $returnObject->type;
}
Example #4
0
function izap_get_supported_videos_list()
{
    global $IZAPSETTINGS;
    $ch = new IzapCurl($IZAPSETTINGS->api_server . 'supported_sites.php');
    $data = $ch->exec();
    $array = unserialize($data);
    foreach ($array as $title => $href) {
        $string[] = '<a href="' . $href . '" title="' . $title . '" target="_blank">' . $title . '</a>';
    }
    return '(' . elgg_echo('izap_videos:total') . ': ' . count($array) . ') ' . implode(', ', $string);
}