get_row("SELECT * FROM ".$wpdb->prefix."allvideogallery_profiles WHERE id=".$profileid);
$this->width = $profile->width;
$this->height = $profile->height;
if( isset($_GET['slg']) && $autodetect == 1 ) {
$slug = $_GET['slg'];
$video = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."allvideogallery_videos WHERE slug='$slug'");
$videoid = $video->id;
} else {
$video = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."allvideogallery_videos WHERE id=".$videoid);
}
if($video->type == 'thirdparty') {
$result = '
';
$result .= $video->thirdparty;
$result .= '
';
} else {
$arr_params = array();
$custpage = ( $profile->custom_page_url ) ? $profile->custom_page_url : $this->curPageURL();
if( isset($_GET['catid']) ) {
$arr_params['catid'] = $_GET['catid'];
}
if( isset($_GET['sort']) ) {
$arr_params['sort'] = $_GET['sort'];
}
$flashvars = 'base='.get_option('siteurl').'&wp=1&vid='.$videoid.'&pid='.$profileid.'&page='.urlencode( @add_query_arg($arr_params, $custpage) );
$detect = new IsMobile();
$result = $detect->isMobile() ? $this->gethtmlplayer( $profile, $video ) : $this->getflashplayer( $profile, $flashvars );
}
$this->updatehits( $video->slug );
$cust_class = ( $profile->custom_player_class ) ? $profile->custom_player_class : 'avs_player';
$output = '' . "\n";
$output .= '' . "\n";
if($profile->title) {
$output .= '
'.$video->title.'
' . "\n";
}
if($profile->category) {
$output .= '
Category : '.$video->category.'
' . "\n";
}
if($profile->hits) {
$output .= '
Hits : '.$video->hits.'
' . "\n";
}
$output .= '
' . "\n";
$output .= $result . "\n";
if($video->description) {
$output .= '
'.$video->description.'
' . "\n";
}
$output .= '
' . "\n";
return $output;
}
public function getflashplayer( $profile, $flashvars ) {
global $allvideogallery_plugin_dir;
$siteurl = get_option('siteurl');
$src = $siteurl . '/wp-content/plugins/' . $allvideogallery_plugin_dir . '/player.swf?random=' . rand();
$result = '';
return $result;
}
public function gethtmlplayer( $profile, $video ) {
if($video->type == 'youtube') {
$url_string = parse_url($video->video, PHP_URL_QUERY);
parse_str($url_string, $args);
$result = '';
} else {
$preview = $video->preview ? 'poster="' . $video->preview . '"' : '';
$result = '';
}
return $result;
}
function curPageURL() {
$pageURL = 'http';
if (!empty($_SERVER['HTTPS'])) {if($_SERVER['HTTPS'] == 'on'){$pageURL .= "s";}}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
function updatehits( $slug ) {
global $wpdb;
$table_name = $wpdb->prefix."allvideogallery_videos";
$video = $wpdb->get_row("SELECT * FROM $table_name WHERE slug='$slug'");
$count = ($video) ? $video->hits + 1 : 1;
$video->hits = $count;
$wpdb->update($table_name, array('hits' => $video->hits), array('id' => $video->id));
}
}
?>