コード例 #1
0
ファイル: izap-videos.php プロジェクト: justangel/izap-videos
/**
 * Load video via ajax
 * 
 * @param integer  $guid
 * 
 * @version 5.0
 */
function izap_get_video_player($guid, $height, $width)
{
    global $IZAPSETTINGS;
    $entity = get_entity($guid);
    $video_src = elgg_get_site_url() . 'izap_videos_files/file/' . $guid . '/' . elgg_get_friendly_title($entity->title) . '.flv';
    $player_path = $IZAPSETTINGS->playerPath;
    if ($entity->videourl) {
        if (elgg_instanceof($entity, 'object', GLOBAL_IZAP_VIDEOS_SUBTYPE, GLOBAL_IZAP_VIDEOS_CLASS)) {
            preg_match("/((http)s?)/", elgg_get_site_url(), $scheme);
            $current_scheme = $scheme[1];
            $pattern = '/(.* src\\s?=\\s?\\")(http[s]?)(:\\/\\/.*)/';
            $replacement = '${1}' . $current_scheme . '$3';
            $source = preg_replace($pattern, $replacement, $entity->videosrc);
            $content = izap_get_replaced_height_width_izap_videos($height, $width, $source);
        } else {
            echo elgg_echo('izap_videos:ajaxed_videos:error_loading_video');
        }
    } else {
        if ($entity->converted == 'yes') {
            $content = "\n           <object width='" . $width . "' height= '" . $height . "' id='flvPlayer'>\n            <param name='allowFullScreen' value='true'>\n            <param name='wmode' value='transparent'>\n            <param name='allowScriptAccess' value='always'>\n            <param name='movie' value='" . $player_path . "?movie=" . $video_src . "&volume=30&autoload=on&autoplay=on&vTitle=" . $entity->title . "&showTitle=yes' >\n            <embed src='" . $player_path . "?movie=" . $video_src . "&volume=30&autoload=on&autoplay=on&vTitle=" . $entity->title . "&showTitle=yes' width='100' height='100' allowFullScreen='true' type='application/x-shockwave-flash' allowScriptAccess='always' wmode='transparent'>\n           </object>";
        } else {
            $content = izap_add_error($entity->guid);
        }
    }
    echo $content;
    exit;
}
コード例 #2
0
ファイル: izap_video.php プロジェクト: justangel/izap-videos
    if ($izap_video->videothumbnail) {
        $thumbnail_image = $izap_video->videothumbnail;
        $style = 'height:400px; width: 100%;border-radius:8px;';
    } elseif ($izap_video->imagesrc) {
        $thumbnail_image = $get_image;
        $style = 'height:400px; width: 100%;border-radius:8px;';
    } else {
        $thumbnail_image = $IZAPSETTINGS->graphics . '/no_preview.jpg';
        $style = 'height:400px; width: 670px;background-color:black;border-radius:8px;';
    }
    $get_player_path = elgg_get_site_url() . GLOBAL_IZAP_VIDEOS_PAGEHANDLER . '/viewvideo/' . $izap_video->guid . '/400/670';
    //load video div
    $content = "<div id='load_video_" . $izap_video->guid . "' class='loader'>";
    $content .= '<a href="' . $get_player_path . '" rel="' . $izap_video->guid . '" class = "ajax_load_video">' . '<img src="' . $thumbnail_image . '"  style= "' . $style . '" />';
    $content .= '<img src="' . $IZAPSETTINGS->graphics . 'c-play.png" class="play_icon"/></a>';
    $content .= izap_add_error($izap_video->guid);
    $content .= '</div>';
    $body = " {$content} {$text} {$summary}";
    echo elgg_view('object/elements/full', array('entity' => $izap_video, 'body' => $body));
} elseif ($view_type == 'all' || $page_type == 'owner') {
    // brief view
    $view_count = izap_get_total_views($izap_video);
    $path = $izap_video->getURL($owner, GLOBAL_IZAP_VIDEOS_PAGEHANDLER);
    $title_length = strlen($izap_video->title);
    if ($title_length > 48) {
        $title = '<a href="' . $path . '">' . substr($izap_video->title, 0, 51) . '...</a>';
    } else {
        $title = '<a href="' . $path . '">' . $izap_video->title . '</a>';
    }
    if ($izap_video->videothumbnail) {
        $thumb_path = $izap_video->videothumbnail;