我试图在这个插件文件中的flash对象的末尾附加一个注释模板。以下是完整代码。要准确指出我在何处添加了评论模板,请参阅this pastebin. 附加注释模板位于第164行。出于某种原因,尽管我附加了注释模板,但注释模板显示在flash对象的上方,而不是下方。有人知道我如何解决这个问题吗?
<?php
require_once(\'ismobile.php\');
/******************************************************************
/* Build Player
******************************************************************/
class Player {
var $width, $height;
public function buildPlayer( $profileid = 1, $videoid = 1, $autodetect = 1 ) {
global $wpdb;
$profile = $wpdb->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 = \'<div style="width:\' . $this->width . \'px; height:\' . $this->height . \'px;">\';
$result .= $video->thirdparty;
$result .= \'</div>\';
} 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\'];
}
$videosids=$video->id;
$imgad_query=mysql_query("select * from ".$wpdb->prefix."allvideogallery_videos WHERE published=\'1\' and id=\'$videosids\'");
$imgad_row=mysql_fetch_array($imgad_query);
$imgads=$imgad_row[\'img_ads\'];
$text_ads1=$imgad_row[\'text_ads\'];
$ads_links1=$imgad_row[\'ads_links\'];
$imgad_link=\'<img src="\'.$imgads.\'" alt="" >\';
$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, $ads_links1, $imgads, $text_ads1 );
}
$this->updatehits( $video->slug );
$cust_class = ( $profile->custom_player_class ) ? $profile->custom_player_class : \'avs_player\';
$output = \'<style type="text/css">\' . "\\n";
$output .= $profile->player_css . "\\n";
$output .= \'.video_div
{
float:left;
width:100%;
}
.ad_text
{
float:left;
/*width:472px;*/
margin:301px 15px 0px 15px;
background-color:#ffffff;
border:1px solid black;
opacity:0.6;
filter:alpha(opacity=60); /* For IE8 and earlier */
color:#000000;
padding:5px 6px;
position:absolute;
z-index: 10000;
display:block;
font-size: 12px;
bottom:63px;
}
.ad_text img
{
max-width:90%;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#clickme").click(function() {
$("#book").hide();
});
});
</script>
\' . "\\n";
$output .= \'<div class="\'.$cust_class.\'" style="width:\'.$this->width.\'px;">\' . "\\n";
if($profile->title) {
$output .= \'<div class="title">\'.$video->title.\'</div>\' . "\\n";
}
if($profile->category) {
$output .= \'<div class="category"><strong>Category : </strong>\'.$video->category.\'</div>\' . "\\n";
}
if($profile->hits) {
$output .= \'<div class="hits"><strong>Hits : </strong>\'.$video->hits.\'</div>\' . "\\n";
}
$output .= \'<div style="clear:both;"></div>\' . "\\n";
$output .= $result . "\\n";
if($video->description) {
$output .= \'<div class="description">\'.$video->description.\'</div>\' . "\\n";
}
$output .= \'</div>\' . "\\n";
return $output;
}
public function getflashplayer( $profile, $flashvars, $ads_links1, $imgads, $text_ads1 ) {
global $allvideogallery_plugin_dir;
if(!empty($imgads)) { $show_ads1=\'<img src="\'.$imgads.\'" alt="">\'; } else { $show_ads1=$text_ads1; }
$get_ads_width=$this->width;
$get_ads_width1=$get_ads_width-30;
$siteurl = get_option(\'siteurl\');
$src = $siteurl . \'/wp-content/plugins/\' . $allvideogallery_plugin_dir . \'/player.swf?random=\' . rand();
$result .= \'<div class="video_div" style="width:\' . $this->width . \'px; height:\'.$this->height.\'px;"> <div style="width:100%; height:100%; position:relative;">\';
if(!empty($imgads) || !empty($text_ads1)) {
$result .= \'<div class="ad_text" id="book" style="width:\'.$get_ads_width1.\'px;" >\';
$result .= \'<p style="float:right; width:4%; margin:0px;">\';
$result .= \'<a href="#" id="clickme" style="float:right; line-height:0px;"><img src="\'.site_url().\'/wp-content/plugins/all-video-gallery/close_icon.png"></a></p>\';
//$result .= \'\';
$result .= \'<a href="\'.$ads_links1.\'">\'.$show_ads1.\'</a>\';
$result .= \'</div>\';
}
$result .= \'<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="\' . $this->width . \'" height="\' . $this->height . \'">\';
$result .= \'<param name="movie" value="\' . $src . \'" />\';
$result .= \'<param name="wmode" value="opaque" />\';
$result .= \'<param name="allowfullscreen" value="true" />\';
$result .= \'<param name="allowscriptaccess" value="always" />\';
$result .= \'<param name="flashvars" value="\' . $flashvars . \'" />\';
$result .= \'<div><object type="application/x-shockwave-flash" data="\' . $src . \'" width="\' . $this->width . \'" height="\' . $this->height . \'">\';
$result .= \'<param name="movie" value="\' . $src . \'" />\';
$result .= \'<param name="wmode" value="opaque" />\';
$result .= \'<param name="allowfullscreen" value="true" />\';
$result .= \'<param name="allowscriptaccess" value="always" />\';
$result .= \'<param name="flashvars" value="\' . $flashvars . \'" />\';
$result .= \'</object></div>\';
$result .= \'</object></div></div>\';
$result .= comments_template(); //Append the comments template to the 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 = \'<iframe title="YouTube Video Player" width="\'.$this->width.\'" height="\'.$this->height.\'" \';
$result .= \'src="http://www.youtube.com/embed/\'.$args[\'v\'].\'" frameborder="0" allowfullscreen></iframe>\';
} else {
$preview = $video->preview ? \'poster="\' . $video->preview . \'"\' : \'\';
$result = \'<video onclick="this.play();" width="\'.$this->width.\'" height="\'.$this->height.\'" \'.$preview.\' controls>\';
$result .= \'<source src="\'.$video->video.\'" />\';
$result .= \'</video><br />\';
$result .= comments_template(); //Append the comments template to the 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));
}
}
?>