Jump to content

WP Plugin - Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION


Recommended Posts

Hey guys.. I"m a php novice and Im trying to fix a wordpess plugin code which featured many empty white spaces. I removed the white spaces, but now Im left with some syntax errors.. because this script is sooo long i'm only including the top portion and the bottom portion of the code. The entire php document is attached to the post.

 

Here's the error..

Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /home4/oklahon2/public_html/thesocialanimal/wp-content/plugins/wp-petfinder/wp-petfinder.php on line 1667

Here's the code.

<?php /* 
Plugin Name: Wp Petfinder Plugin 
Plugin URI: http://www.thesocialanimal.com
Description: Show the Petfinder feed on your Sidebar.
Version: 1.0 
Author: Emily Garman 
Author URI: http://www.thesocialanimal.com
*/?>
<?php
/*  Copyright 2010  (email : info@thesocialanimal.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as 
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
?><?php require_once('VFXP.inc.php');
class wp_petfinder extends WP_Widget {
public $pet_name=array();
public $pet_id=array();
public $pet_description=array();
public $pet_sheterid=array();
public $pet_image=array();
public $pet_shelter_name=array();
public $pet_shelter_city=array();
public $pet_shelter_state=array();
public $pat_index=0;
public $shelter_index=1;
//public $request_methods=array(1=>'breed.list',2=>'pet.get',3=>'pet.getRandom',4=>'pet.find',5=>'shelter.find',6=>'shelter.get',7=>'shelter.getPets',8=>'shelter.listByBreed');
public $request_methods=array(1=>'Show a pet By PetId',2=>'Show Random pets');function wp_petfinder() {$widget_ops = array('description' => __('Show pets from petfinder.com') );
 $this->WP_Widget('wordpresspetfinder', __('wp pet finder'), $widget_ops);}
  function widget($args, $instance) {
 		extract($args, EXTR_SKIP);
		echo $before_widget;
		//echo '<link rel="stylesheet" href="'.get_bloginfo('url').'/wp-content/plugins/wp-petfinder/css/wp-petfinder.css" type="text/css" />';
echo '	<div  id="petfinder_widget_container">
	<div  id="top_curve_layout">
		<div id="top_curve_lt"></div>
		<div  id="top_curve_rt"></div>
	</div>	
	<div id="petfinder_animal_container">';
		$title = empty($instance['title']) ? __('Featured Adoptable Pet') : apply_filters('widget_title', $instance['title']);
				$parameters=	array(
'title' => $instance['title'],
'api_key' => $instance['api_key'],
	 'api_secret' => $instance['api_secret'],
	 'request_type' => (int)$instance['request_type'],
	'pet_get_id' => $instance['pet_get_id'],
	'pet_random_shelter'=>$instance['pet_random_shelter'],
	'pet_random_animal'=>$instance['pet_random_animal'],
	'pet_random_count'=>$instance['pet_random_count']

*******************Top part of code / Bottom of code ******************************

var newImgNext = new Image();

			newImgNext.src = '<?php echo $this->pet_image[$i];?>';



			delay(

			alert(newImgNext.width)

			var heightnext;*/





			imagewidth='<?php echo $width;?>';imagehight='<?php echo $height;?>';





			absoluteWidth=containerWidth-20



				if(imagewidth>absoluteWidth)

				{

					thumWidth=absoluteWidth;

				}

				else

				{

					thumWidth=imagewidth;



				}



				var imageRatio=thumWidth/imagewidth;

				thumbHeight=imageRatio*imagehight;<?php /*?>						document.write('<a href="http://www.petfinder.com/petnote/displaypet.cgi?petid=<?php echo $this->pet_id[$i];?>"><img src="<?php bloginfo('url'); ?>/wp-content/plugins/wp-petfinder/thumb.php?i=<?php echo $this->pet_image[$i];?>&w='+thumWidth+'&h='+thumbHeight+'"></a>')<?php */?>
document.write('<a href="http://www.petfinder.com/petnote/displaypet.cgi?petid=<?php echo $this->pet_id[$i];?>"><img src="<?php echo $this->pet_image[$i];?>" width="'+thumWidth+'" height="'+thumbHeight+'"></a>')
</script><?php /*?><a href="http://www.petfinder.com/petnote/displaypet.cgi?petid=<?php echo $this->pet_id[$i];?>"><img src="<?php echo $this->pet_image[$i];?>"  border="0" class="pet_image"/></a><?php */?>
<br /><?php echo '<span class="blue_txt">Pet Name:</span><a href="http://www.petfinder.com/petnote/displaypet.cgi?petid='.$this->pet_id[$i].'" class="pat_name_link">'.$this->pet_name[$i].'</a><br/>';
//echo 'Description:'.$this->pet_description.'<br/>';
echo '<span class="blue_txt">Shelter Name:</span>'.$this->pet_shelter_name[$i].'<br/>';

echo '<span class="black_txt">City:</span>'.$this->pet_shelter_city[$i].'<br/>';

echo '<span class="black_txt">State:</span>'.$this->pet_shelter_state[$i].'<br/>';
}

/*function petfind_js(){



if(!is_admin()){

echo '<link rel="stylesheet" href="'.get_bloginfo('url').'/wp-content/plugins/wp-petfinder/css/wp-petfinder.css" type="text/css" />

';



}

}

add_action('wp_print_scripts','petfind_js');*/

}
function add_extra_css(){
$fileDir = plugins_url('',__FILE__).'/';
?><link rel="stylesheet" href="<?php echo $fileDir.'css/wp-petfinder.css';?>" type="text/css" media="screen" />
<?php 
add_action ('wp_head','add_extra_css');
add_action ('widgets_init', create_function('','return register_widget("wp_petfinder")' );?>

 

This last sentence is where the syntax error occurs.

Thank you in advance for your help..

:shrug:

 

 

[attachment deleted by admin]

 

Hi! replace the line

add_action ('widgets_init', create_function('','return register_widget("wp_petfinder")' );

 

with

 

add_action ('widgets_init', create_function('','return register_widget("wp_petfinder")') );

 

and let me know the result.

 

Thanks!

 

--------------------------------------------------

http://ScriptsTurbo.com  --- Innovative Web developers and designers group

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.