Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fatal Error function: glob()


Guest

Recommended Posts

Posted

Hi

 

Can anyone please help me with the following error which I'm getting whilst trying to configure the cc_show.php contribution:

 

Fatal error: Call to undefined function: glob() in /usr/local/htdocs/freetibet/catalog/includes/classes/cc_show.php on line 83

 

The web address is:

 

http://www.freetibet.org/catalog/checkout_payment.php

 

Any help would be massively appreciated >_<

Posted

duno about the cc-show constib but you might have a error cause i dont know of a function called glob. maybe you should check your readme and look for a function called glob

or check if there is a function in you includes/functions/general.php file

i guess you would just need to add it. if you find in your readme a function called global or simular you need to change it in the file where you have the error corresponding to the function!

 

hope i did not confuse you to much ;-)

 

greetz john

Posted
duno about the cc-show constib but you might have a error cause i dont know of a function called glob. maybe you should check your readme and look for a function called glob

or check if there is a function in you includes/functions/general.php file

i guess you would just need to add it. if you find in your readme a function called global or simular you need to change it in the file where you have the error corresponding to the function!

 

hope i did not confuse you to much ;-)

 

greetz john

 

Hi John

 

The glob() function is in cc_show.php :

 

<?php

/*

$Id: cc_show.php,v 1.0 2004/12/10 00:47:43 mhormann $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 Matthias C. Hormann

 

Released under the GNU General Public License

*/

 

/*

A highly versatile class to show what Payment Gateways and/or Credit Cards you accept.

WITHOUT EVER TOUCHING SOURCE CODE AGAIN!

Just name your icon files nicely and pop them into the images/cc/ folder, and you are set!

 

Example: Put these files in your 'images/cc/' folder:

cclogo_Paypal_(Pound_Sterling).gif (simply use PayPal's button and rename it)

ccicon_MasterCard.gif

ccicon_UK_Green.gif

ccicon_UK_Purple.gif

ccicon_Discover.gif

 

What you will get:

Beautifully lined up images like 'PAYPAL ( Discover MasterCard UKGreen UKPurple )' <-- the images, cc's in brackets

All images have 'alt' text, so if you hover the mouse over PAYPAL, it will say 'Paypal (Pound Sterling)' <-- whatever you put in the name!

 

A text representation like "We accept: Discover, MasterCard, UK Green, UK Purple."

 

Can display as text as well as nice images.

Use it everywhere: On your payment conditions page, in your payment module, ...

The possibilities are endless!

 

SIMPLE USAGE SAMPLE:

 

$myCC = new cc_show("includes/modules/payment/paypal/images/cc/"); <-- this would be to use it with the PayPal IPN system

echo "We work together with " . $myCC->get_gw_names() . " to make payments easy and secure for you.";

echo "We accept: " . $myCC->get_cc_names(" - "); // separator changed from default to 'blank-dash-blank'

echo "Gateway Logo(s): " . $myCC->get_gw_images();

echo "Credit Cards taken: " . $myCC->get_cc_images();

echo "It can look like this: " . $myCC->get_all_images(true); // Gateway plus CC images lined up, CCs nicely bracketed

 

For more, have a look at the functions below - they're documented.

*/

 

 

class cc_show {

var $cc_image_url, $cc_logo_prefix, $cc_image_prefix, $cc_image_ext, $gw, $cc;

 

// class constructor

// cc_show($basedir)

// $basedir - the directory where your CC images can be found; default = DIR_WS_IMAGES . 'cc/'

// Don't forget the ending '/'!

function cc_show($basedir = '') {

$this->cc_image_url = DIR_WS_IMAGES . 'cc/'; // URL for logo & cc icon images

$this->cc_logo_prefix = 'cclogo_'; // prefix for Payment Gateway Logos

$this->cc_image_prefix = 'ccicon_'; // prefix for Credit Card Names

$this->cc_image_ext = '.gif'; // file type

// unset($this->gw);

// unset($this->cc);

$this->set_url($basedir);

}

 

// cc_show->set_url($basedir)

// to reset base url for existing class

function set_url($basedir) {

if (tep_not_null($basedir)) {

$this->cc_image_url = $basedir;

}

}

 

// $this->update_gw() [internal]

// to update (re-check) the image directory for Payment Gateway Logos, i.e., 'cclogo_*.gif'

function update_gw() {

$this->gw = glob($this->cc_image_url . $this->cc_logo_prefix . '*' . $this->cc_image_ext);

return (!empty($this->gw));

}

 

// $this->update_cc() [internal]

// to update (re-check) the image directory for Credit Card Icons, i.e., 'ccicon_*.gif'

function update_cc() {

$this->cc = glob($this->cc_image_url . $this->cc_image_prefix . '*' . $this->cc_image_ext);

return (!empty($this->cc));

}

 

// $this->add_brackets($imagelist, $parameters, $width, $height) [internal, external]

// to add nice brackets around a pre-parsed set of images (uses 'open.gif', 'close.gif' in image dir)

// for internal use here, but COULD be used to put these brackets around anything else ;-)

//

// $imagelist - pre-generated string containing HTML <img ...> tags already, bracket code gets added

// $parameters - additional params for the <img...> tag; use "" within; default: 'align="absmiddle"'

// $width - width of bracket image (or none = take as is); will be used for both; default: none

// $height - height of bracket image (or none = take as is); will be used for both; default: none

function add_brackets($imagelist, $parameters='align="absmiddle"', $width='', $height='') {

if (!empty($imagelist)) {

$imagelist =

tep_image($this->cc_image_url . 'open' . $this->cc_image_ext, '', $width, $height, $parameters) . ' ' .

$imagelist . ' ' .

tep_image($this->cc_image_url . 'close' . $this->cc_image_ext, '', $width, $height, $parameters);

}

return $imagelist;

}

 

// cc_show->get_gw_names($separator)

// to show a textual list of installed Payment Gateway Names, separated by whatever you wish

// The names are taken from the 'cclogo_*.gif' files, here are some examples:

// cclogo_MoneyBookers.gif, cclogo_PayPal.gif --> "MoneyBookers, PayPal"

// cclogo_Paypal_(Euros).gif, cclogo_Paypal_(Pound_Sterling).gif --> "Paypal (Euros), Paypal (Pound Sterling)"

//

// $separator - user-defined separation string, only used BETWEEN names; default: ', '

function get_gw_names($separator=", ") {

$logolist = '';

if ($this->update_gw()) {

foreach ($this->gw as $file) {

if (!empty($logolist)) {

$logolist .= $separator;

}

$logolist .= str_replace(array($this->cc_logo_prefix, '_'), array('', ' '), basename($file, $this->cc_image_ext));

}

}

return $logolist;

}

 

// cc_show->get_cc_names($separator)

// to show a textual list of Credit Cards you take, separated by whatever you wish

// The names are taken from the 'ccicon_*.gif' files, here are some examples:

// ccicon_MasterCard.gif, ccicon_Visa_Electron.gif, ccicon_UK_Purple.gif --> "MasterCard, Visa Electron, UK Purple"

// ccicon_We_accept_MasterCard_only!.gif --> "We accept MasterCard only!"

//

// $separator - user-defined separation string, only used BETWEEN names; default: ', '

function get_cc_names($separator=", ") {

$imagelist = '';

if ($this->update_cc()) {

foreach ($this->cc as $file) {

if (!empty($imagelist)) {

$imagelist .= $separator;

}

$imagelist .= str_replace(array($this->cc_image_prefix, '_'), array('', ' '), basename($file, $this->cc_image_ext));

}

}

return $imagelist;

}

 

// cc_show->get_gw_images($brackets, $parameters, $width, $height)

// To show a graphical list of installed Payment Gateways (icons, buttons or logos), with or without brackets around them.

// Returns a ready-made string of 'tep_image' produced HTML tags. Image tags are separated by a blank.

// The names for the images 'alt' tags are taken from the file names, as in 'get_gw_names()'.

// Images can be forced to have a fixed width and/or height using the appropriate parameter. ALL will have the same width/height!

// Provision is made for an extra parameter for each image, that is per default set to 'align="absmiddle"'.

// It can be decided if the images are enclosed within graphical brackets, i.e. 'open.gif' and 'close.gif' in your image dir.

//

// $brackets - boolean: enclose images in brackets or not? (like '[gw1 gw2 gw3]' vs. 'gw1 gw2 gw3'); default: false

// $parameters - extra params to be applied to every image; use "" within; default: 'align="absmiddle"'

// $width - force width of each and every image to be this value; default: none (= use actual image width)

// $height - force height of each and every image to be this value; default: none (= use actual image height)

// Specifying $height and/or $width will also apply to the bracket image files!!!

function get_gw_images($brackets=false, $parameters='align="absmiddle"', $width='', $height='') {

$logolist = '';

if ($this->update_gw()) {

foreach ($this->gw as $file) {

if (!empty($logolist)) {

$logolist .= ' ';

}

$logolist .= tep_image($file, str_replace(array($this->cc_logo_prefix, '_'), array('', ' '), basename($file, $this->cc_image_ext)), $width, $height, $parameters);

}

if ($brackets) {

$logolist = $this->add_brackets($logolist, $parameters, $width, $height);

}

}

return $logolist;

}

 

// cc_show->get_cc_images($brackets, $parameters, $width, $height)

// To show a graphical list of Credit Cards you take (iconic), with or without brackets around them.

// Returns a ready-made string of 'tep_image' produced HTML tags. Image tags are separated by a blank.

// The names for the images 'alt' tags are taken from the file names, as in 'get_cc_names()'.

// Images can be forced to have a fixed width and/or height using the appropriate parameter. ALL will have the same width/height!

// Provision is made for an extra parameter for each image, that is per default set to 'align="absmiddle"'.

// It can be decided if the images are enclosed within graphical brackets, i.e. 'open.gif' and 'close.gif' in your image dir.

//

// $brackets - boolean: enclose images in brackets or not? (like '[cc1 cc2 cc3]' vs. 'cc1 cc2 cc3'); default: false

// $parameters - extra params to be applied to every image; use "" within; default: 'align="absmiddle"'

// $width - force width of each and every image to be this value; default: none (= use actual image width)

// $height - force height of each and every image to be this value; default: none (= use actual image height)

// Specifying $height and/or $width will also apply to the bracket image files!!!

function get_cc_images($brackets=true, $parameters='align="absmiddle"', $width='', $height='') {

$imagelist = '';

if ($this->update_cc()) {

foreach ($this->cc as $file) {

if (!empty($imagelist)) {

$imagelist .= ' ';

}

$imagelist .= tep_image($file, str_replace(array($this->cc_image_prefix, '_'), array('', ' '), basename($file, $this->cc_image_ext)), $width, $height, $parameters);

}

if ($brackets) {

$imagelist = $this->add_brackets($imagelist, $parameters, $width, $height);

}

}

return $imagelist;

}

 

// cc_show->get_all_images($brackets, $parameters, $width, $height)

// To make a nice graphic representation of Payment Gateway PLUS credit cards, without all the hassle.

// Defaults to a middle-aligned image row like this: GW1 GW2... ( CC1 CC2 CC3 CC4... )

// For details, see cc_show->get_gw_images and cc_show->get_cc_images.

function get_all_images($brackets=true, $parameters='align="absmiddle"', $width='', $height='') {

$imagelist = $this->get_gw_images(false, $parameters, $width, $height);

if (!empty($imagelist)) {

$imagelist .= ' ';

}

$imagelist .= $this->get_cc_images($brackets, $parameters, $width, $height);

return $imagelist;

}

}

?>

 

Callum

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...