Hi Folks
I really could use some assistance with this...
Parse error: syntax error, unexpected T_STRING in /home/shipblac/public_html/ship/wp-content/plugins/wp-vipergb/_output_guestbook.php on line 80
<?php
//Include the comment-upload handler plugin
require_once('easy-comment-uploads/main.php');
/**
* This is the only function you need to generate a WP-Viper Guestbook - simply
* "echo vgb_GetGuestbook()" in any of your templates.
*
* Note: Templates that use this guestbook should NOT call comments_template().
* Note: Requires the_post() to've been called already, i.e. we're in The Loop.
* Note: See the $defaults array for available options.
*/
function vgb_GetGuestbook( $opts=array() )
{
$defaults = array(
'entriesPerPg' => 10, //Number if entries to show per page
'reverseOrder' => false, //Reverse the order of entries (oldest first)
'allowUploads' => false, //Allow users to upload images
'maxImgSizKb' => 50, //Max uploadable image size (if allowUploads is set)
'showBrowsers' => true, //Show browser/OS icons in guestbook entries
'showFlags' => true, //Show national flags in guestbook entries (REQUIRES OZH IP2NATION)
'hideCred' => false, //Omit "Powered by WP-ViperGB" (please don't though :))
'showCredLink' => false //Include a link to the project page in the "Powered by WP-ViperGP" (would be appreciated :))
);
$opts = wp_parse_args( $opts, $defaults );
if( vgb_is_listing_pg() ) return vgb_get_listing_pg($opts);
else return vgb_get_sign_pg($opts);
}
/********************************************************************************/
/******************************IMPLEMENTATION************************************/
/********************************************************************************/
//PHP Arguments
define('VB_SIGN_PG_ARG', 'sign'); //"Sign" page (vs "Listing" page)
define('VB_PAGED_ARG', 'cpage'); //Paged Comments pagenumber
/**
* Return true if this is the LISTING page, false if it's the SIGN page
*/
function vgb_is_listing_pg()
{
return !isset($_REQUEST[VB_SIGN_PG_ARG]);
}
/**
* Return the URL to the plugin directory, with trailing slash
*/
function vgb_get_data_url()
{
return plugins_url(dirname(plugin_basename(__FILE__))) . '/';
}
/**
* Return the current page number (in listing view)
*/
function vgb_get_current_page_num()
{
return max(get_query_var(VB_PAGED_ARG), 1);
}
/**
* Get the header: Show Guestbook | Sign Guestbook, and *maybe* paged nav links
*/
function vgb_get_header( $itemTotal, $entriesPerPg )
{
//Comment
global $vgb_name, $vgb_version;
$retVal = "<!-- $vgb_name v$vgb_version -->\n";
//Show Guestbook | Sign Guestbook
$isListingPg = vgb_is_listing_pg();
$retVal .= '<div id="gbHeader">';
$retVal .= '<div id="gbNavLinks">';
if( !$isListingPg ) $retVal .= "<a href=\"".get_permalink()."\">";
$retVal .= __('Show Guestbook', WPVGB_DOMAIN);
if( !$isListingPg ) $retVal .= "</a>";
$retVal .= " | ";
if( $isListingPg ) $retVal .= "<a href=\"".htmlspecialchars(add_query_arg(VB_SIGN_PG_ARG, 1))."\">";
$retVal .= __('Sign Guestbook', WPVGB_DOMAIN);
if( $isListingPg ) $retVal .= "</a>";
$retVal .= "</div>";
//Paged nav links
if($isListingPg && $itemTotal > $entriesPerPg)
{
$curPage = vgb_get_current_page_num();
$maxPages = ceil($itemTotal/$entriesPerPg);
$retVal .= '<div id="gbPageLinks">' . __('Page',WPVGB_DOMAIN) . ': ';
if( $maxPages > 1 )
{
for( $i = 1; $i <= $maxPages; $i++ )
{
if( $curPage == $i || (!$curPage && $i==1) ) $retVal .= "(" . $i . ") ";
else $retVal .= "<a href=\"".htmlspecialchars(add_query_arg(VB_PAGED_ARG, $i))."\">$i</a> ";
}
}
$retVal .= "</div>";
}
$retVal .= "</div>";
return $retVal;
}
/*************************************************************************/
/************************Output the LISTINGS PAGE*************************/
/*************************************************************************/
function vgb_get_listing_pg($opts)
{
//Capture output
ob_start();
//First, get the comments and make sure we have some
global $comment, $post;
$comments = get_comments( array('post_id' => $post->ID, 'order' => ($opts['reverseOrder']?'ASC':'DESC') ) );
$commentTotal = count($comments);
//Output the header
echo vgb_get_header($commentTotal, $opts['entriesPerPg']);
//Check for "no entries"
if( $commentTotal == 0 ):
echo '<div id="gbNoEntriesWrap">' . __('No entries yet', WPVGB_DOMAIN) . '.</div>';
else:
//Take a SLICE of the comments array corresponding to the current page
$curPage = vgb_get_current_page_num();
$comments = array_slice($comments, ($curPage-1)*$opts['entriesPerPg'], $opts['entriesPerPg']);
$commentCounter = $commentTotal - ($curPage-1)*$opts['entriesPerPg'];
//And output each comment!
?>
<div id="gbEntriesWrap">
<?php foreach( $comments as $comment ): ?>
<table class="gbEntry page-nav" cellspacing="0">
<tr>
<td class="gbEntryLeft" rowspan="3">
<table cellspacing="0">
<tr>
<td class="leftSide"><?php _e('EntryNo', WPVGB_DOMAIN)?>:</td>
<td class="rightSide">
<?php
if($opts['reverseOrder']) echo $commentTotal - ($commentCounter--) + 1;
else echo $commentCounter--;
?>
</td>
</tr>
<tr>
<td valign="top" class="leftSide"><?php _e('Date', WPVGB_DOMAIN)?>:</td>
<td class="rightSide">
<?php echo get_comment_date('l')?><br /><?php echo get_comment_time(__('H:i',WPVGB_DOMAIN))?><br /><?php echo get_comment_date(__('m.d.Y',WPVGB_DOMAIN))?>
</td>
</tr>
</table>
</td>
<td class="gbEntryTop" valign="middle" align="left" >
<div class="gbAuthor">
<img alt="ip" src="<?php echo vgb_get_data_url()?>img/ip.gif" /> <?php echo $comment->comment_author?><?php edit_comment_link('..', '');?>
</div>
<div class="gbFlagAndBrowser">
<?php
if( $opts['showBrowsers'] )
{
if( !function_exists('pri_images_string') ) include_once('browsersniff/browsersniff.php');
$browser_name= $browser_code= $browser_ver= $os_name= $os_code= $os_ver=$pda_name= $pda_code= $pda_ver= $image=