classes/php5_classes/Addon.class.php

Properties

Description

Main file for addon infrastructure, this is what makes addons go!

Constants

  GEO_ADDONS_ENABLED = 1




Classes

geoAddon

Properties

 
 
System  
No 
No 

Description

This is the class that handles anything and everything to do with addons.

Methods

__construct, _templateCopy, adminDisplayPlanItemLinks, coreEventCount, coreEventsLoaded, disableAddon, getApiAddons, getAppTopAddons, getEnabledList, getInfoClass, getInstalledInfo, getInstance, getOrderTypeAddons, getPageAddons, getPageList, getPagesClass, getPaymentGatewayAddons, getRealName, getRegistry, getSellerBuyerAddons, getTagList, getTags, getText, getTextAddons, getTextRaw, getUtil, initAdmin, isEnabled, isInstalled, loadCoreEvents, loadEnabled, loadInstalled, setDefaultPageTemplate, setText, smartyDisplayTag, textNoLicense, triggerDisplay, triggerUpdate, updateTemplates,

__construct( ) : n/a

Description

Constructor. Do not create new geoAddon class, use geoAddon::getInstance() instead. This constructor is private to prevent creating new geoAddon objects all willy nilly.

Return value

Type Description
n/a n/a

_templateCopy( string   $name, string   $type = 'main_page', string   $sub = '', ) : n/a

Description

Used by updateTemplates() to copy over templates for given addon.

Arguments

Name Type Description Default
$name string

the addon name.

$type string

The type like main_page or external or whatever

'main_page'
$sub string

for recurive calls

''

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 5.0.1

adminDisplayPlanItemLinks( string   $itemType = '', bool   $skipCategory = false, ) : string

Description

Returns an entire section to be displayed in the admin, containing links to each price plan, which will have the given item type's configuration button automatically "selected".

Arguments

Name Type Description Default
$itemType string

The item type to have already open (configuration "clicked")

''
$skipCategory bool

if true, will not display category specific links

false

Return value

Type Description
string A bit of HTML perfect for displaying in the admin.

Tags

Name Description
since Version 4.1.0

coreEventCount( string   $core_event_name, ) : int

Description

Gets the number of addons using the given core event.

Arguments

Name Type Description Default
$core_event_name string

Return value

Type Description
int

coreEventsLoaded( ) : Boolean

Description

Whether or not core events have loaded or not.

Return value

Type Description
Boolean true if the core events have been initialized, or false otherwise.

disableAddon( string   $addon_name, bool   $temporary = true, ) : n/a

Description

Disable a specific addon, either just for this page load, or by also disabling it in the DB. Using this to disable an addon in the DB will bypass the normal enable() method call for the addon, so should only be used when the particular addon being disabled is known.
This must be called AFTER {@link geoAddon::loadEnabledAddons()} is called, otherwise it will not work.

Arguments

Name Type Description Default
$addon_name string
$temporary bool

If false, will change the DB entry to disable the addon in the dB as well, bypassing the addon's normal disable() method call.

true

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 4.0.7

getApiAddons( ) : boolean|array

Description

Get api addons for use in admin

Return value

Type Description
boolean|array The array of pages, or bool false on error or nonoe found

getAppTopAddons( ) : boolean|array

Description

Get addons with an app top in them

Return value

Type Description
boolean|array Array of addons, or bool false on error

getEnabledList( ) : array

Description

Get an array of enabled addons, array will be an associative array of arrays like this:
array ( 'addon_name' => array ('name' => 'addon_name', 'title' => 'addon title', 'info' => $info_class), ... )

Return value

Type Description
array

Tags

Name Description
since Version 5.0.1

getInfoClass( string   $addon_name, bool   $force = false, ) : Mixed

Description

Gets the info class for the specified addon, or false if not enabled addon or not a valid addon.

Arguments

Name Type Description Default
$addon_name string
$force bool

If true, will get the info class even if adon is not enabled.

false

Return value

Type Description
Mixed The info class for the addon, or false if the addon is not enabled, installed.

Tags

Name Description
since Version 5.0.0

getInstalledInfo( String   $addon_name, ) : Mixed

Description

Gets the info about an installed addon. Only gets data from the database, does not check to see if addon files exist.

Arguments

Name Type Description Default
$addon_name String

Return value

Type Description
Mixed An associative array containing the data from the database if the addon is installed in the database, or false otherwise.

getInstance( ) : \geoAddon

Description

Gets an instance of the addon class, to keep from creating multiple instances when we only need one.

Return value

Type Description
\geoAddon

getOrderTypeAddons( ) : array

Description

Get addons that have order items in them

Return value

Type Description
array The array of addons

getPageAddons( string   $addon_name = 0, ) : boolean|array

Description

Get page addons for use in admin

Arguments

Name Type Description Default
$addon_name string

If specified, the addon name

0

Return value

Type Description
boolean|array The array of pages, or bool false on error or nonoe found

getPageList( ) : array

Description

Gets an array of all the pages for all the currently enabled templates, mostly useful for admin panel purposes. Does NOT bother to check for valid method being defined in each pages class, only goes by what is defined in the info class.

Return value

Type Description
array

Tags

Name Description
since Version 5.0.0

getPagesClass( String   $addon_name, ) : Object|bool

Description

This is used to get the pages object for a given addon.

Arguments

Name Type Description Default
$addon_name String

Return value

Type Description
Object|bool The pages object for the given addon, or false if the addon is not enabled, installed, or the pages file or class doesn't exists.

getPaymentGatewayAddons( ) : array

Description

Get addons that have payment gateways in them

Return value

Type Description
array The array of addons

getRealName( String   $addon_name, ) : String

Description

Gets the real name, if the addon is already installed. This is necessary to get addon management working on some Windows servers, where all file names are all lowercase.

Arguments

Name Type Description Default
$addon_name String

Lowercase addon string

Return value

Type Description
String The corrected addon name. If addon is not installed, returns the same name as passed.

getRegistry( string   $addon_name, bool   $force = false, ) : \geoRegistry|null

Description

Gets a geoRegistry item for the specified addon, to allow getting and setting values specific to a particular addon.

Arguments

Name Type Description Default
$addon_name string
$force bool

set to true to get registry even if addon is not enabled.

false

Return value

Type Description
\geoRegistry|null Will return null if invalid or disabled addon

getSellerBuyerAddons( ) : array

Description

Get addons that have seller/buyer gateways in them

Return value

Type Description
array The array of addons

getTagList( string   $tagType = 'addon', ) : array

Description

Gets an array of all the tags for all the currently enabled templates, mostly useful for admin panel purposes. Does NOT bother to check for valid method being defined in each tags class, only goes by what is defined in the info class.

Arguments

Name Type Description Default
$tagType string

The type of tag, addon means standard tag defined in $tags array in the info. Parameter added in version 7.1.0

'addon'

Return value

Type Description
array

Tags

Name Description
since Version 5.0.0

getTags( String   $addon_name, ) : Mixed

Description

Gets the tag object for a given addon name, if it exists, and is installed and enabled in the database.

Arguments

Name Type Description Default
$addon_name String

Return value

Type Description
Mixed The tags class object for the given addon, or false if the addon is not enabled, installed, or the tag file or class doesn't exists.

getText( string   $auth_tag, string   $addon_name, int   $language_id = 0, bool   $force_refresh = false, ) : array

Description

Gets the text for the addon. This is most useful to addons, to get the text for their addon.

Arguments

Name Type Description Default
$auth_tag string
$addon_name string
$language_id int

If set, will use this instead of current language id.

0
$force_refresh bool

True to force it to retrieve text even if the text has already been retrieved this page load

false

Return value

Type Description
array An associative array of messages for the given addon, following the syntax: array ( 'text_index1' => 'text value 1', 'text_index2' => 'text value 2')

getTextAddons( \(optional)String   $addon_name = 0, bool   $includeDisabled = false, ) : Array

Description

Used to get addon admin objects

Arguments

Name Type Description Default
$addon_name \(optional)String 0
$includeDisabled bool

True to get even disabled addons

false

Return value

Type Description
Array If $addon_name is supplied, will return the admin object for that addon, so that init_text can be called for it. If no addon_name is supplied, returns an array of info objects where the admins have init_text functions. If there are no admin objects, returns false.

getTextRaw( string   $auth_tag, string   $addon_name, \number   $language_id = 0, ) : array

Description

Gets the "raw" addon text for given addon and language, it doesn't even fromDB the results. Useful mostly in the admin where need to access the values before they are parsed for {external} tags

Arguments

Name Type Description Default
$auth_tag string
$addon_name string
$language_id \number 0

Return value

Type Description
array

Tags

Name Description
since Version 7.1.0

getUtil( String   $addon_name, boolean   $force = false, ) : Mixed

Description

Second most used addon function, this is used to get the utility object for a given addon.

Arguments

Name Type Description Default
$addon_name String
$force boolean

forces a non-enabled addon to be callable, for example, in the setup

false

Return value

Type Description
Mixed The util object for the given addon, or false if the addon is not enabled, installed, or the util file or class doesn't exists.

initAdmin( string   $menuName, ) : n/a

Description

Used in the admin to go through each installed & enabled addon, which has an admin file and class, and has the init function defined.
Used to load each addon's admin menu item into memory, for page loading and to create the dynamic menu.

Arguments

Name Type Description Default
$menuName string

The main menu that is being loaded.

Return value

Type Description
n/a n/a

isEnabled( String   $addon_name, ) : Boolean

Description

Determines if an addon is installed, and enabled in the database, and that the addon info file and class exist.

Arguments

Name Type Description Default
$addon_name String

Return value

Type Description
Boolean true if the addon is installed, enabled, and info file & class exist

isInstalled( String   $addon_name, ) : Boolean

Description

Determines if an addon is installed in the database. Note that this does NOT check to see if the files for the addon exist or not.

Arguments

Name Type Description Default
$addon_name String

The name of the addon to check.

Return value

Type Description
Boolean true if the addon is installed in the database, false otherwise.

loadCoreEvents( ) : n/a

Description

Loads the addons with core events into a local class var (their util classes) for use by other addon functions dealing with core events. This is automatically run by other addon functions that need to access core events.

Return value

Type Description
n/a n/a

loadEnabled( bool   $force = false, ) : n/a

Description

Loads the enabled addons and their info classes into local class vars, so that they can be used internally. This is called automatically from the other addon functions, so it is not required to be called.

Arguments

Name Type Description Default
$force bool

If true, will force re-loading enabled even if they were already loaded for the page load

false

Return value

Type Description
n/a n/a

loadInstalled( \(Optional)Boolean   $force_refresh = false, ) : n/a

Description

Loads the installed addons installed through the database. This does not check if the addon files exist. This is mainly used by the loadEnabledAddons() function. If you are getting data using the other addon functions, this is automatically called by those functions.

Arguments

Name Type Description Default
$force_refresh \(Optional)Boolean

if true, will get always get the settings from the database, even if they have already been retrieved and stored.

false

Return value

Type Description
n/a n/a

setDefaultPageTemplate( string   $addon, string   $page, string   $tplName, string|null   $tplContents = null, ) : bool

Description

Allows addons to set the default page template used for an addon page, that will be set inside the default template set, so that the default will always be there.
We recommend to now use this, since there is already built-in functionality to do this for you, using the $info->pages_info array. Using that instead will ensure the default template attachment is set when re-scanning default template set as well.

Arguments

Name Type Description Default
$addon string

The addon name

$page string

The page name

$tplName string

The template file name - this can be a template in the default template set, or can be a new template file

$tplContents string|null

If not null, the tpl file will be created and the tpl contents will be inserted.

null

Return value

Type Description
bool True if success, false otherwise. If in admin, upon failure this will automatically add admin error messages.

Tags

Name Description
since Version 5.0.0

setText( String   $auth_tag, String   $addon, String   $text_id, String   $text, \Int(optional)   $language_id = 1, ) : n/a

Description

Sets the text for the addon, should only need to be set in the admin addon text management.

Arguments

Name Type Description Default
$auth_tag String
$addon String
$text_id String

max length is 128

$text String
$language_id \Int(optional)

If set, will use this language id. Defaults to 1.

1

Return value

Type Description
n/a n/a

smartyDisplayTag( array   $params, \Smarty_Internal_Template   $smarty, string   $addonName, string   $tag, string   $tagType = 'addon', ) : n/a

Description

Loads up displaying an addon tag for smarty.

Arguments

Name Type Description Default
$params array

The params as passed in for the smarty function.

$smarty \Smarty_Internal_Template

The smarty object as passed in for the function.

$addonName string
$tag string
$tagType string 'addon'

Return value

Type Description
n/a n/a

textNoLicense( ) : string

Description

Used internally by Geo addons, just a message saying the addon is not attached to the license, used so text only needs to be edited in one place and not hard coded into every licensed addon.

Return value

Type Description
string

triggerDisplay( string   $core_event_name, mixed   $vars = null, string   $trigger_type = \geoAddon::RETURN_STRING, string   $separator = '', ) : mixed

Description

Calls the specified display function, and seperates the returned responses using $seperator (or other special case uses of seperator, see below)

Arguments

Name Type Description Default
$core_event_name string
$vars mixed null
$trigger_type string

One of: geoAddon::RETURN_STRING - call returns string, this returns all strings separated by $separator geoAddon::FILTER - call returns $var filtered, this returns $var after being filtered geoAddon::ARRAY_ARRAY - call returns non-empty array, this returns array of arrays geoAddon::ARRAY_STRING - call returns string, this returns array of strings. geoAddon::BOOL_TRUE - This returns true if any call returns true, false otherwise. Once a true value is returned, no other addon calls are made. geoAddon::BOOL_FALSE - This returns false if any call returns false, true otherwise. Once a false value is returned, no other addon calls are made. geoAddon::NOT_NULL - call returns null, or anything else. this returns the first non-null value, or null (main use: can be used as a combination of BOOL_TRUE and BOOL_FALSE geoAddon::OVERLOAD - call returns geoAddon::NO_OVERLOAD or anything else, upon first addon not returning geoAddon::NO_OVERLOAD, it will stop calling any more addons and return that value.

\geoAddon::RETURN_STRING
$separator string

Used if trigger_type is geoAddon::RETURN_STRING

''

Return value

Type Description
mixed Depends on what trigger_type is.

triggerUpdate( string   $core_event_name, mixed   $vars = null, ) : int

Description

Calls the specified core update function. Does not expect any return values from the calls.

Arguments

Name Type Description Default
$core_event_name string
$vars mixed null

Return value

Type Description
int Count of the number of addons called.

updateTemplates( string   $addonName, ) : bool

Description

Used mostly by admin panel, this will scann an addon and copy over any templates to the default template set, and set the attachments for the addon pages if $info->pages_info is used properly.

Arguments

Name Type Description Default
$addonName string

Return value

Type Description
bool

Tags

Name Description
since Version 5.0.1

Constants

  ARRAY_ARRAY = 'array_array'




  ARRAY_STRING = 'array_string'




  BOOL_FALSE = 'bool_false'




  BOOL_TRUE = 'bool_true'




  FILTER = 'filter'




  NOT_NULL = 'not_null'




  NO_OVERLOAD = 'no_overload'




  OVERLOAD = 'overload'




  RETURN_STRING = 'return_string'




Documentation was generated by phpDocumentor 2.2.0 .

Namespaces

  • global

    Packages

    • Default
      • ExampleAddon
        • addon_example_admin
          In charge of doing stuff on the admin side, this is optional.
        • addon_example_info
          Required class for addons, this is the Addon information class, used by the addon system to determine what the addon can do. Also contains info about the addon that can be viewed in the addon management page in the admin.
        • addon_example_pages
          Addon page class, used by the addon system to display pages on the client side.
        • addon_example_setup
          This class is not required. If it, and the function for a particular routine exist, then that function will be called IN ADDITION TO the automated routines of the addon framework.
        • addon_example_tags
          Expects one function for each tag. Function name should be the same as the tag name. Can also have a constructor if anything needs to be constructed.
        • addon_example_util
          This is where to put functions that the main part of the addon will use.
        • eWidgetOrderItem
          This order item is designed to allow users on your site to purchase an eWidget.
      • System
        • DataAccess
          This is the main Database access object.
        • Singleton
          Singleton method class
        • _templateOrderItem
          Developers: use this file as a template to create a new order item.
        • _templatePaymentGateway
          This is the "developer template" payment gateway handler, a developer could use this file as a starting point for creating a new payment gateway in the system.
        • geoAPI
          The main system class for receiving and handling remote API calls, this acts as a translation layer between the communication with the "outside" and each API call.
        • geoAddon
          This is the class that handles anything and everything to do with addons.
        • geoArrayTools
          Utility functions for manipulating arrays
        • geoBrowse
          Contains functions common to browsing listings
        • geoBrowsingFilter
          System for activating, storing, and deactivating browsing filters.
        • geoCJAX
          Class that wraps the CJAX_FRAMEWORK, used to get the CJAX class.
        • geoCache
          This is the main part of the Geo cache system, it does all the "low level" stuff like writing files and escaping cache data.
        • geoCacheModule
          Part of Geo Cache system, specifically tuned to work best with cacheing module data (which will be an array).
        • geoCachePage
          Cache system specifically tuned to work best with cacheing output of pages and modules
        • geoCacheSetting
          Part of Geo Cache system, specifically tuned to work best with cacheing site-wide key=value type settings.
        • geoCacheText
          Part of Geo Cache system, this part specifically tuned to work best with cacheing language specific messages.
        • geoCalendar
          Holds utility method(s) for manipulating stuff dealing with calendar selector.
        • geoCart
          This class is behind the cart, loading all the order items and such and displaying, and processing all the different pages.
        • geoCategory
          Utility class that holds various methods to do stuff with categories in the system.
        • geoCombineResources
          This class helps to combine CSS and JS files, minify them, and optionally compress them.
        • geoCron
          This is the cron job backend, it handles all the communication and security and all that.
        • geoCrypt
          Class to use for encrypting information that needs to be able to be retrieved later.
        • geoDate
          Holds utility method(s) for manipulating stuff dealing with dates.
        • geoEmail
          Class that sends out e-mails.
        • geoFields
          Class that holds settings information for fields to use.
        • geoFieldsField
          A mini object to hold data about a specific field.
        • geoFile
          As the name implies, this is used for file-based utility methods.
        • geoFilter
          A few utility methods, good for filtering stuff.
        • geoFormatString
          Used to display a message nice and pretty, we'll probably be getting rid of this class though so don't go crazy using it.
        • geoHTML
          Class to generate chunks of HTML that are very common, used the most in the admin panel.
        • geoImage
          This class is responsible for a lot of the image processing, along with other aspects like generating the image tag for thumbnails.
        • geoInvoice
          This is the invoice object representing an invoice in the system.
        • geoLeveledField
          Class for doing common things with leveled fields.
        • geoListing
          A listing object, basically a container object for particular listing.
        • geoListingDisplay
          This is basically a container that is responsible for helping to display {listing .
        • geoListingFeed
          Class that helps to render RSS or other types of feeds based on list of listings.
        • geoMaster
          This is dedicated class for getting the value of, and setting, the various "master switches" within the software. Since this is meant as an easy way to get the values of master switches, most of the methods are static.
        • geoNumber
          Utility functions relating to number conversion/manipulation/validation ect.
        • geoOrder
          The geoOrder object, an object representation of an order in the system.
        • geoOrderItem
          The class that all order items must extend.
        • geoPC
          Used for login credential validation, password hashing, etc. along with software licensing.
        • geoPagination
          Utility functions useful for generating pagination of a results page such as when browing ads or searching
        • geoPaymentGateway
          This class should be extended by each different payment gateway, this will have some default functions that each gateway will inherit, and also has a few final static methods used by the system to affect all order items.
        • geoPlanItem
          A container to hold settings for a particular order item type, according to price plan ID, and optionally category ID for category specific settings.
        • geoRecurringBilling
          The geoRecurringBilling object, an object representation of a recurring billing in the system.
        • geoRegion
          Stuff for regions and sub-regions.
        • geoRegistry
          Handy little object, can be used to set registry type settings.
        • geoSearchUtils
          Class for search utilities.
        • geoSellerBuyer
          Handles back-end for the seller/buyer payment gateways, to allow the buyer to more easily pay the seller for a won auction. This handles the underlying system, but the actual work is done by individual seller/buyer gateways, for instance the Paypal buy-now functionality.
        • geoSession
          Manages session storage and session cookies for user sessions.
        • geoString
          Utility functions relating to languages and string manipulation.
        • geoStringData
          This class is to store accented chars, to be used by {@link geoString::removeAccents()}, mainly to keep the String.class.php file un-cluttered.
        • geoTable
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRow
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRowset
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableSelect
          Class used to generate a select query, useful when multiple areas want to affect a single query, for instance when generating a search query and there are addons involved.
        • geoTables
          Used to hold database table names, used throughout the code.
        • geoTemplate
          Template object that extends the Smarty class (a 3rd party library) to enable using templates to display things.
        • geoTransaction
          This is the object used for a transaction in the order and invoice system.
        • geoUser
          An object representative of a certain user in the system.
        • geoUserRating
          Store, retrieve, and display inter-user ratings
        • geoUtil
          Misc utility functions
        • geoView
          As the name implies, this is used for creating the page view. It does take a little setup (like any class), the setup is normally done in the display_page method in geoSite, or display_page in geoAdmin if displaying a page in the admin.
        • iApiTransport
          Interface for API Transports, a transport must implement this interface for the system to use it.
        • iOrderItem
          You cannot have abstract static functions, so instead need to have an interface to force the given static functions to be defined.
        • metaDbTables
          Used so that old locations that use the old name geoTables will still work.