So in an effort to help remove legacy functions found in functions.inc.php I created a new BMO style class method called doCheckExtensions() as a replacement for the current $mod_check_extensions() legacy function.
I’ve made the updates to BMO/Extensions.class.php in framework that will check for this new class method and falling back to the existing legacy function check. I have PR Add check for new BMO style method doCheckExtensions() to replace legacy method by blazestudios97 · Pull Request #229 · FreePBX/framework · GitHub submitted.
Here is an example from my Advanced Call Spy module using the function.
/**
* Check Extensions Hook
* @param bool|array $exten
* @return array $extenlist
*/
public function doCheckExtensionsHook($exten=true): array
{
$extenlist = [];
if (is_array($exten) && empty($exten)) {
return $extenlist;
}
$sql = "SELECT spycode, description FROM advcallspy_details";
if (is_array($exten)) {
$sql .= "WHERE spycode in ('".implode("','",$exten)."')";
}
$sql .= " ORDER BY spycode";
$results = sql($sql,"getAll",DB_FETCHMODE_ASSOC);
foreach ($results as $result) {
$thisexten = $result['spycode'];
$extenlist[$thisexten]['description'] = _("Advanced Call Spy: ").$result['description'];
$extenlist[$thisexten]['status'] = 'INUSE';
$extenlist[$thisexten]['edit_url'] = 'config.php?display=advcallspy&extdisplay='.urlencode($thisexten);
}
return $extenlist;
}