Global Functions in 12 and Higher

Global Functions in 12 and Higher

Global Functions

These functions can be used throughout FreePBX to obtain relevant data. Click below to see more about each function:

 

 

Check if a BMO module class has a callable method

Check if a BMO module class has a callable method, will check status of said module first before checking on it

/**  * Check to see if said module has method and is publicly callable  * @param {string} $module The raw module name  * @param {string} $method The method name  */ FreePBX::Modules()->moduleHasMethod($module, $method);

Get all modules that have method

Get an array of all BMO modules that have said method

/**  * Get all modules that have said method  * @param {string} $method The method name to look for  */ FreePBX::Modules()->getModulesByMethod($method);

Check status

Check the status of said module to see if it is said state.

The 5 states are as follows:

  • MODULE_STATUS_NOTINSTALLED

  • MODULE_STATUS_DISABLED

  • MODULE_STATUS_ENABLED

  • MODULE_STATUS_NEEDUPGRADE

  • MODULE_STATUS_BROKEN

/**  * Boolean return for checking a module's status  * @param {string} $modname Module Raw Name  * @param {constant} $status  Integer/Constant, status to compare to  */ FreePBX::Modules()->checkStatus($modname,$status=MODULE_STATUS_ENABLED);

Get signature of Module

Get the signature status of Module

/**  * Get Signature  * @param string $modulename The raw module name  * @param bool $cached     Get cached data or update the signature  */ FreePBX::Modules()->getSignature($modulename,$cached=true);

Parse Module XML

Get the module XML of module as a simpleXML object

/**  * Parse a modules XML from filesystem  *  * This function loads a modules xml file from the filesystem, and return  * a simpleXML object.  This explicitly does NOT care about the active or  * inactive state of the module. It also caches the object, so this can  * be called multiple times without re-reading and re-generating the XML.  *  * @param (string) $modname Raw module name  * @returns (object) SimpleXML Object.  *  * @throws Exception if module does not exist  * @throws Exception if module xml file is not parseable  */ FreePBX::Modules()->getXML($modname = false);