BillingFox addons

BillingFox addons can expand your website functionalities, you can learn how to use them in our documentation.

Choose a documentation section.

Addons are used by BillingFox to extend it's functions. How to create an addon? Create the following default addon directory structure: -> YourAddonName (dir) -> run.php (file)

IMPORTANT: AN ADDON IS USED WHEN $_GET['addon_use'] is 'YourAddonName' (used on addon checking) $_GET['something'] is your url variable like >https://YourWebsite/index?variable1=test1&variable2=test2&variable3=test3

Here are 3 GET variables:

$_GET['variable1'] have value test1
$_GET['variable2'] have value test2
$_GET['variable3'] have value test3

ADDON PAGES ARE WORKING ONLY ON CLIENT AREA AND LOGIN/REGISTER (panel) PAGE FOR SECURITY REASONS:
IMPORTANT: THE ADDON PRINCIPAL FILE IS 'run.php'.

Things to know about addons:
The principal file of an addon is named 'run.php' (without quotes)
uninstall process of addon is located on (addon directory)/uninstall.php (deleting tables of addon and addon row in BF_addons table)
run.php and uninstall.php are mandatory for addon functionality
- AddonDirectory/functions/menu.php is a tiny file used to generate menu items, example:
$menu_item[] = BF_add_menu_item('client_area?addon_use=MarketPlace', '<img src="content/addons/MarketPlace/icons/BillingFox-gray-mini.png" style="width:
15px; height: 15px;" alt="BillingFox Icon">', 'BillingFox MarketPlace');

Menu item will redirect you to 'your-website.com/client_area?addon_use=MarketPlace', it will create a menu item that have icon '<img src="content/addons/
MarketPlace/icons/BillingFox-gray-mini.png" style="width: 15px; height: 15px;" alt="BillingFox
Icon">' (image or fontawesome icon, ANYTHING), and text of menu item will be 'BillingFox MarketPlace'

'AddonDirectory/service_buttons/buttons.php' is used to generate service menu buttons
'AddonDirectory/frontend/frontend.php' is used by addons to make client area pages for normal users, you can acces them with https://yourwebsite.com/
client_area?addon_use=Your_Addon
NOTE: directories of addons are loaded automatically by BillingFox, they are optionally so you don't must create them if you don't need.
'AddonDirectory/admin_actions' is a directory used by admin area on use of run.php, so you can edit it's name if you specify that on 'run.php' file.
'AddonDirectory/functions' is a directory used to make functions on top (top of script, running before loading of theme), header (before </head> tag) and
footer (running before </body> tag) [FOLDER FILES MUST BE NAMED:
'top.php','header.php' and 'footer.php' AND ALL MUST BE IN 'functions' directory of addon], also this directory is handling other actions of BillingFox.
'AddonDirectory/functions/fields.php' is a file that is creating custom fields for product that are using this addon (valid name values of inputs: domain,
use_nameservers (boolean, if is set to 1, domain is required), server_ns1_pre, server_ns2_pre,
server_user, server_pass, server_hostname, specifications) , EVERY input from here must have form="addform" in input tag
'AddonDirectory/functions/dfields.php' is a file that is creating custom fields for domain that are using this addon when it is added to cart.

'AddonDirectory/functions/instant_info.php' is a file that is good to create a product on external API or to offer informations for services with instant
activation, variables that you can use here:
$_SESSION['woExpire_on'] - Expiration date of product;
$_SESSION['wo_domain'] - domain of product;
$_SESSION['wo_domainrequired'] - (boolean) domain required status;
$_SESSION['woPrice'] - price of product;
$_SESSION['wo_pass'] - password of product;
$_SESSION['wo_user'] - user of product;
$_SESSION['wo_hostname'] - hostname of product;
$_SESSION['wo_ns1_pre'] - first nameserver prefix of product;
$_SESSION['wo_ns1_pre'] - 2nd nameserver prefix of product;
$_SESSION['wo_token'] - random token of product;
$_SESSION['wo_addon'] - Addon of product;
$_SESSION['item_name'] - product name;
$_SESSION['item_id'] - ID of product;
$_SESSION['wo_specifications'] - Specifications about the order, these are additional informations created by addons seen only by administration (You can set
this only).

NOTE: $_SESSION['wo_token'] is usually used to make random unique IDs for products, by using that you can make differences between services in addons.

In this file you MUST set $_SESSION['info'] (informations of service) and you can set also $_SESSION['user'] and $_SESSION['pass'];
'functions/on_expire.php' is a file that is good to suspend a product on external API on service expiration;
'functions/on_push_accept.php' is a file that is included when a service push is accepted;
'functions/on_push_reject.php' is a file that is included when a service push is rejected;
'functions/on_login.php' is a file that is included when an user is logging in with success (you can use available $_POST and $_SESSION['email_login'] to get information);
'functions/on_register.php' is a file that is included when an user is registering with success (you can use available $_POST and $_SESSION['email_login'] to get information);

'AddonDirectory/functions/on_add_to_cart.php' is the file that runs after adding an item to cart, you can use addon POST variables & billingfox inputs, GET parametsrs and selects to improve your file better;
'AddonDirectory/functions/on_renew.php' is a file that is good to suspend a product on external API on service expiration, variables that you can use:

$_SESSION['svdo_id'] - the service order ID
$_SESSION['svdo_newExpire'] - new expiration date
$_SESSION['svdo_token'] - service order token

'AddonDirectory/functions/create_fields.php' is a file that is included after an order is created, you can use all POST
variables from the creation form.

'AddonDirectory/functions/on_create.php' Is a file with all inputs added on order creation page, it gets the post variables from 'AddonDirectory/functions/create_fields.php' and order creation page.

If order creation type is domain you can use the variable $creationDomain to get the domain name.

'AddonDirectory/functions/on_service_activate.php' Is a file with all inputs added on service activation page, it gets the post variables from 'AddonDirectory/functions/activate_fields.php' and service activation page page.

Payment addon functionalities:
'payment' is a directory that must have payment page and payment methods on it (see Paypal_Gateway addon to observe)
'AddonDirectory/payment/payment_page.php' is the payment page that is using an addon;
'AddonDirectory/payment/funds_payment_page.php' is the page that will create pay-for-deposit page;
'AddonDirectory/payment/payment_methods.php' is the page that will create payment methods on BillingFox cart page (Use checkboxes with name 'payment_option');
'AddonDirectory/payment/payment_options.php' is the page that will create <option value="addon_name">Addon Name</option>, payment options for deposit page

'AddonDirectory/system.php' is the file that contains payment verification and functions after an user buy something;
Admin things:
'AddonDirectory/admin_area_buttons' is the directory that contains files for admin area buttons.
'AddonDirectory/admin_area_buttons/buttons.php' is the file that is used to create custom buttons on admin area.
Login/Register things:
'AddonDirectory/login_area' is the directory that is creating buttons on login system;
'AddonDirectory/register_area' is the directory that is creating buttons on registration system;
If order to create invoices you can take PayPal_Gateway addon as an example, you must include "/install/PDF.class.php" to get access to FPDF class, please use it carefully.
YOU CAN DO ANYTHING WITH ADDONS, DON'T FORGET TO GET INSPIRATION FROM EXISTING ADDONS.

run.php's installation example content:

Copy to clipboard
// Addons run.php example content <?php <?php if(addon_in_db('Partnerox') == 'YES' && addon_activated('Partnerox') == 'YES') { if($_GET['admin_area']) { $this->render('admin_actions/addon_manage', array('addon'), true, true); } } else { $installWizard = array( 'addon' => array( 'alt_name' => 'Partnerox', 'alt_description' => 'Manage partners from your website to use them easily in your themes.' ), 'addon_tables' => array( array( 'table_name' => 'BF_partnerox', 'table_structure' => array( 'partner_id' => array( 'attributes' => 'BIGINT AUTO_INCREMENT' ), 'partner_link' => array( 'attributes' => 'varchar(255) DEFAULT NULL' ), 'partner_name' => array( 'attributes' => 'varchar(255) DEFAULT NULL' ), 'partner_logo' => array( 'attributes' => "varchar(255) DEFAULT 'default'" ), 'partner_since' => array( 'attributes' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP' ), ), 'table_primary' => 'partner_id', ), ), ); $wizardStatus = runAddonWizard($installWizard); $this->render('admin_actions/addon_manage', array('addon'), true, true); } ?> ?>

uninstall.php's example content:

Copy to clipboard
// Addons uninstall.php example content <?php $installWizard = array( 'addon' => array( 'alt_name' => 'Partnerox' ), 'addon_tables' => array( array( 'table_name' => 'BF_partnerox' ), ), ); $wizardStatus = runAddonUninstallWizard($installWizard);