Location: PHPKode > projects > Freeway > freeway_1_5_Alpha/create_admin_button.php
<?php 
/*
	osCommRes, Services Oline 
	http://www.oscommres.com 
	Copyright (c) 2005 osCommRes 
	
	Freeway eCommerce 
	http://www.zac-ware.com/freeway 
	Copyright (c) 2007 ZacWare
	
	Released under the GNU General Public License
*/
require('includes/application_top.php');

$type=isset($HTTP_GET_VARS["type"])?$HTTP_GET_VARS["type"]:1;
$text=isset($HTTP_GET_VARS["text"])?$HTTP_GET_VARS["text"]:'';
$color=isset($HTTP_GET_VARS["color"])?$HTTP_GET_VARS["color"]:'FFFFFF';
$image_name=isset($HTTP_GET_VARS["image_name"])?$HTTP_GET_VARS["image_name"]:'';
$source_name=isset($HTTP_GET_VARS["source"])?$HTTP_GET_VARS["source"]:'size';
$default=isset($HTTP_GET_VARS["default"])?$HTTP_GET_VARS["default"]:'';
$case=isset($HTTP_GET_VARS["case"])?$HTTP_GET_VARS["case"]:'U';
	$hexcolor = str_split($color, 2); 
	// Convert HEX values to DECIMAL
	$bincolor[0] = hexdec("0x{$hexcolor[0]}");
	$bincolor[1] = hexdec("0x{$hexcolor[1]}");
	$bincolor[2] = hexdec("0x{$hexcolor[2]}");

if ($default=="Y"){
	$image_list[]=array("name"=>"button_add",
						"text"=>"Add",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_add_address",
						"text"=>"Add Address",
						"source"=>'',
						"type"=>3
						);
	$image_list[]=array("name"=>"button_add_funds",
						"text"=>"Add Funds",
						"source"=>'',
						"type"=>3
						);
	$image_list[]=array("name"=>"button_add_wishlist",
						"text"=>"Add to Wishlist",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_address_book",
						"text"=>"Address Book",
						"source"=>'',
						"type"=>4
						);
	$image_list[]=array("name"=>"button_affiliate_banners",
						"text"=>"Banners",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_affiliate_build_a_link",
						"text"=>"Build Link",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_affiliate_sales",
						"text"=>"Sales Report",
						"source"=>'',
						"type"=>4
						);
	$image_list[]=array("name"=>"button_back",
						"text"=>"Back",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_change_address",
						"text"=>"Change Address",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_checkout",
						"text"=>"Checkout",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_confirm",
						"text"=>"Confirm",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_confirm_order",
						"text"=>"Confirm",
						"source"=>'',
						"type"=>4
						);
	$image_list[]=array("name"=>"button_confirm_upload",
						"text"=>"Confirm Upload",
						"source"=>'',
						"type"=>7
						);
	$image_list[]=array("name"=>"button_continue",
						"text"=>"Continue",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_continue_order",
						"text"=>"Continue",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_continue_shopping",
						"text"=>"Continue Shopping",
						"source"=>'',
						"type"=>7
						);
	$image_list[]=array("name"=>"button_customer_reviews",
						"text"=>"Customer Reviews",
						"source"=>'',
						"type"=>7
						);
	$image_list[]=array("name"=>"button_day_view",
						"text"=>"Day",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_day_view_selected",
						"text"=>"Day",
						"source"=>'size_over',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_delete",
						"text"=>"Delete",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_details",
						"text"=>"Details",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_edit_account",
						"text"=>"Edit Account",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_free_trial",
						"text"=>"Free Trial",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_history",
						"text"=>"Order History",
						"source"=>'',
						"type"=>6
						);
	$image_list[]=array("name"=>"button_in_cart",
						"text"=>"Add to Cart",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_invite",
						"text"=>"Invite Friends",
						"source"=>'',
						"type"=>6
						);
	$image_list[]=array("name"=>"button_login",
						"text"=>"Sign In",
						"source"=>'',
						"type"=>1
						);
						
	$image_list[]=array("name"=>"button_month_view",
						"text"=>"Month",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_month_view_selected",
						"text"=>"Month",
						"source"=>'size_over',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_more_reviews",
						"text"=>"More Reviews",
						"source"=>'',
						"type"=>6
						);
	$image_list[]=array("name"=>"button_notifications",
						"text"=>"Notifications",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_printorder",
						"text"=>"Print Order",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_products",
						"text"=>"Products",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_quick_find",
						"text"=>"Go",
						"source"=>'',
						"type"=>0
						);
	$image_list[]=array("name"=>"button_redeem",
						"text"=>"Redeem",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_remind_me",
						"text"=>"Remind Me",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_remove_notifications",
						"text"=>"Remove Notifications",
						"source"=>'',
						"type"=>7
						);
	$image_list[]=array("name"=>"button_reserve",
						"text"=>"Reserve",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_reserve_event",
						"text"=>"Reserve",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_reviews",
						"text"=>"Reviews",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_search",
						"text"=>"Search",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_search_small",
						"text"=>"Search",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_select",
						"text"=>"Buy Now",
						"source"=>'',
						"type"=>3
						);
	$image_list[]=array("name"=>"button_send",
						"text"=>"Send",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_shipping_options",
						"text"=>"Shipping Options",
						"source"=>'',
						"type"=>7
						);
	$image_list[]=array("name"=>"button_submit_link",
						"text"=>"Submit Link",
						"source"=>'',
						"type"=>5
						);
	$image_list[]=array("name"=>"button_submit_survey",
						"text"=>"Submit",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_update",
						"text"=>"Update",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_update_cart",
						"text"=>"Update",
						"source"=>'',
						"type"=>2
						);
	$image_list[]=array("name"=>"button_week_view",
						"text"=>"Week",
						"source"=>'',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_week_view_selected",
						"text"=>"Week",
						"source"=>'size_over',
						"type"=>1
						);
	$image_list[]=array("name"=>"button_write_review",
						"text"=>"Write Review",
						"source"=>'',
						"type"=>6
						);
	$image_list[]=array("name"=>"button_reset",
						"text"=>"Reset",
						"source"=>'',
						"type"=>1
						);
						
	for ($icnt=0;$icnt<count($image_list);$icnt++){
		if ($image_list[$icnt]["source"]=="") $image_list[$icnt]["source"]="size";
		if ($case=="U") 
			$text=strtoupper($image_list[$icnt]["text"]);
		else if ($case=="L")
			$text=strtolower($image_list[$icnt]["text"]);
		else if ($case=="F")
			$text=substr($image_list[$icnt]["text"],0,1) . strtolower(substr($image_list[$icnt]["text"],1));
		else
			$text=$image_list[$icnt]["text"];
		$source_image=DIR_FS_CATALOG . DIR_WS_TEMPLATES . $template . "/images/buttons/" . $language . "/" . $image_list[$icnt]["source"] . "_" . $image_list[$icnt]['type'] . ".gif";
		$dest_image=DIR_FS_CATALOG . DIR_WS_TEMPLATES . $template . "/images/buttons/" . $language . "/" . $image_list[$icnt]["name"] . ".gif";

		$font_path = 'c:\windows\fonts\arialbd.ttf';
		$dimensions=imagettfbbox(8,0,$font_path,$text);
		$font_width=$dimensions[2]-$dimensions[0];
		$font_height=$dimensions[1]-$dimensions[7];
		
		$im = imagecreatefromgif($source_image); 
		$orange = imagecolorallocate($im, $bincolor[0], $bincolor[1], $bincolor[2]);
		$px = (imagesx($im) - $font_width) / 2;
		$py = (imagesy($im) - $font_height) / 2;
		imagettftext($im,8,0,$px,$py+$font_height+1,$orange,$font_path,$text);
		imagegif($im,$dest_image); 
		imagedestroy($im);
	}
} else {
	$source_image=DIR_FS_CATALOG . DIR_WS_TEMPLATES . $template . "/images/buttons/" . $language . "/" . $source_name . "_" . $type . ".gif";
	$dest_image=DIR_FS_CATALOG . DIR_WS_TEMPLATES . $template . "/images/buttons/" . $language . "/" . $image_name . ".gif";
	
	$font_path = 'c:\windows\fonts\arialbd.ttf';
	$dimensions=imagettfbbox(8,0,$font_path,$text);
	$font_width=$dimensions[2]-$dimensions[0];
	$font_height=$dimensions[1]-$dimensions[7];
	
	$im = imagecreatefromgif($source_image); 
	$orange = imagecolorallocate($im, $bincolor[0], $bincolor[1], $bincolor[2]);
	$px = (imagesx($im) - $font_width) / 2;
	$py = (imagesy($im) - $font_height) / 2;
	//imagestring($im, 3, $px, $py, $text, $orange); 
	imagettftext($im,8,0,$px,$py+$font_height,$orange,$font_path,$text);
	imagegif($im,$dest_image); 
	imagedestroy($im);
}
?>
Return current item: Freeway