I need to find if Joomla's SEF is enabled or not.
To make things worse, Joomla has different SEF mechanisms (see here for more info).
The function I need to fill in is simple:
function rewrite_enabled(){
return (boolean)$something; // typecast is frivolous
}
The only idea I have so far is:
function rewrite_enabled(){
$url='index.php?option=com_xyz';
return JRoute($url)!=$url;
}
Maybe normalizing both URLs (lowercase or by get vars) might make the function a little bit more effective, though it sounds like a big hack, with serious repercussions.
Of course, searched for an answer on Joomla Docs, StackOverflow and Google, without any success. I also inspected Joomla's runtime internals, and but nothing came up.
When using Joomla's Core SEF System you could get yourself the config and check if SEF is set to true.
$conf = &JFactory::getConfig();
echo ' SEF is: '.(($conf->sef == 1) ? 'on' : 'off');
(not tested)
Hope it helps a bit. Cheers
For Joomla 3.x you will need:
$conf = &JFactory::getConfig();
echo ' SEF is: '.(($conf->get('sef') == 1) ? 'on' : 'off');