This is no longer reliable enough. It is unable to accurately perform partial or full matches for plugin URLs. It's also not efficient having to perform a database query per menu item. Instead all menu items should be grabbed then parsed. Ideally this should be done entirely using Joomla menu API instead of having to call the database directly as well. This is already partially implemented with $_CB_framework->itemid and can simply be improved further there.