* Send to friend class
* Author: Icon Interactive Group - www.iconinteractive.com
* Date: July 20th, 2004
*
*
* This class is designed to place a link on any page for a user to click on and
* recommend the site to a friend. The user can then fill in their name and email
* address as well as their friend's name and email address, and any comments they
* would like to include with it.
*
* Public methods
* ------------------
* SendToFriend()
This is the constructor for the SendToFriend class. When called, it places
a small image and a customizable (in global.inc.php) message. When clicked,
it opens up popup window (sendtofriend.html) and provides a form for the
user to fill in the appropriate values required to send the email to the
person's friend.
getTitle()
This method parses the current website and returns the information between the
<title> and </title> tags. If no title has been provided, the method returns
the string "untitled."
********************************************************************************************/
class SendToFriend
{
function SendToFriend()
{
global $IMAGE_LOCATION;
global $MESSAGE;
?>
<script language='javascript'>
function sendToFriend(pagetitle)
{
var urlName = "sendtofriend.html?pagetitle=" + pagetitle;
window.open(urlName, '', 'status=no, width=450, height=425, scrollbars=yes');
}
</script>
<a href="javascript:sendToFriend('<?print $this->getTitle();?>');"><img src="<?=$IMAGE_LOCATION?>sendtofriend.gif" border="0" /> <?=$MESSAGE;?></a>
<?
}
function getTitle()
{
global $PHP_SELF;
$filename = basename($PHP_SELF); //get the core filename
if( file_exists($filename) ) //if the file can be successfully read
{
$handle = fopen($filename, "r");
$page = fread($handle, filesize("$filename"));
fclose($handle);
//parse the site for the title information
list($junk,$title) = explode("<title>",$page);
list($title,$junk) = explode("</title>",$title);
}
if($title) //if a title was successfully found
return $title;
else //no title was found, return default value
return "Untitled";
}
}//end class
|
|